Class: Temping::ModelFactory
- Inherits:
-
Object
- Object
- Temping::ModelFactory
- Defined in:
- lib/temping.rb
Instance Method Summary collapse
-
#initialize(model_name, options = {}, &block) ⇒ ModelFactory
constructor
A new instance of ModelFactory.
- #klass ⇒ Object
Constructor Details
#initialize(model_name, options = {}, &block) ⇒ ModelFactory
Returns a new instance of ModelFactory.
34 35 36 37 38 39 |
# File 'lib/temping.rb', line 34 def initialize(model_name, = {}, &block) @model_name = model_name @options = klass.class_eval(&block) if block_given? klass.reset_column_information end |
Instance Method Details
#klass ⇒ Object
41 42 43 44 45 |
# File 'lib/temping.rb', line 41 def klass @klass ||= Object.const_get(@model_name) rescue NameError @klass = build end |