Class: FactoryGirl::EvaluatorClassDefiner
- Inherits:
-
Object
- Object
- FactoryGirl::EvaluatorClassDefiner
- Defined in:
- lib/factory_girl/evaluator_class_definer.rb
Instance Method Summary collapse
- #evaluator_class ⇒ Object
-
#initialize(attributes, callbacks, parent_class) ⇒ EvaluatorClassDefiner
constructor
A new instance of EvaluatorClassDefiner.
Constructor Details
#initialize(attributes, callbacks, parent_class) ⇒ EvaluatorClassDefiner
Returns a new instance of EvaluatorClassDefiner.
3 4 5 6 7 8 9 10 11 |
# File 'lib/factory_girl/evaluator_class_definer.rb', line 3 def initialize(attributes, callbacks, parent_class) @parent_class = parent_class @callbacks = callbacks @attributes = attributes attributes.each do |attribute| define_attribute(attribute.name, attribute.to_proc) end end |
Instance Method Details
#evaluator_class ⇒ Object
13 14 15 16 17 18 19 20 |
# File 'lib/factory_girl/evaluator_class_definer.rb', line 13 def evaluator_class @evaluator_class ||= Class.new(@parent_class).tap do |klass| klass.callbacks ||= [] klass.callbacks += @callbacks klass.attribute_lists ||= [] klass.attribute_lists += [@attributes] end end |