Class: FactoryGirl::Evaluation

Inherits:
Object
  • Object
show all
Includes:
Observable
Defined in:
lib/factory_girl/evaluation.rb

Instance Method Summary collapse

Constructor Details

#initialize(evaluator, attribute_assigner, to_create) ⇒ Evaluation

Returns a new instance of Evaluation.



7
8
9
10
11
# File 'lib/factory_girl/evaluation.rb', line 7

def initialize(evaluator, attribute_assigner, to_create)
  @evaluator = evaluator
  @attribute_assigner = attribute_assigner
  @to_create = to_create
end

Instance Method Details

#create(result_instance) ⇒ Object



15
16
17
18
19
20
# File 'lib/factory_girl/evaluation.rb', line 15

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



22
23
24
25
# File 'lib/factory_girl/evaluation.rb', line 22

def notify(name, result_instance)
  changed
  notify_observers(name, result_instance)
end