Class: FactoryBot::Evaluation
- Inherits:
-
Object
- Object
- FactoryBot::Evaluation
- Defined in:
- lib/factory_bot/evaluation.rb
Instance Method Summary collapse
- #create(result_instance) ⇒ Object
-
#initialize(evaluator, attribute_assigner, to_create, observer) ⇒ Evaluation
constructor
A new instance of Evaluation.
- #notify(name, result_instance) ⇒ Object
Constructor Details
#initialize(evaluator, attribute_assigner, to_create, observer) ⇒ Evaluation
Returns a new instance of Evaluation.
3 4 5 6 7 8 |
# File 'lib/factory_bot/evaluation.rb', line 3 def initialize(evaluator, attribute_assigner, to_create, observer) @evaluator = evaluator @attribute_assigner = attribute_assigner @to_create = to_create @observer = observer end |
Instance Method Details
#create(result_instance) ⇒ Object
12 13 14 15 16 17 |
# File 'lib/factory_bot/evaluation.rb', line 12 def create(result_instance) case @to_create.arity when 2 then @to_create[result_instance, @evaluator] else @to_create[result_instance] end end |
#notify(name, result_instance) ⇒ Object
19 20 21 |
# File 'lib/factory_bot/evaluation.rb', line 19 def notify(name, result_instance) @observer.update(name, result_instance) end |