Background
Currently, I am working on a Rails application. I have different products that can be processed through different vendors. All vendors require a text file in a particular format in order to process the orders.
I decided to use a Factory class to generate instances of the Formatter classes that will render the order information in the proper format.
In the factory class I was considering using the following code:
class ExportFactory
def self.exporter_class_for_vendor(vendor_name)
class_name = "ProductExporter#{vendor_name}".gsub(' ','').camelize
class_name.constantize
end
end
Question
Would it be save to use ActiveSupport::CoreExtensions::String::Inflections.constantize on data submitted by a user? Or, should I just hard-code the class names.
Note: In this particular application, the only users that would be able to change the given data would be admin users that have full control throughout the system.