class ToQuickform::ElementFactory

ElementFactory

Public Class Methods

create_instance(type, options) click to toggle source

Passes configuration options to instantiated class

# File lib/to_quickform/element_factory.rb, line 23
def self.create_instance(type, options)
  constant = ToQuickform::Element.const_get ActiveSupport::Inflector.camelize(type)
  constant.new options
end
new(element) click to toggle source
# File lib/to_quickform/element_factory.rb, line 17
def self.new(element)
  return create_instance(element["type"], element) if element
  raise ArgumentError, 'must provide element to be instantiated'
end