Class: FactoryGirl::EvaluatorClassDefiner Private

Inherits:
Object
  • Object
show all
Defined in:
lib/factory_girl/evaluator_class_definer.rb

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Instance Method Summary collapse

Constructor Details

#initialize(attributes, parent_class) ⇒ EvaluatorClassDefiner

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of EvaluatorClassDefiner.



4
5
6
7
8
9
10
11
# File 'lib/factory_girl/evaluator_class_definer.rb', line 4

def initialize(attributes, parent_class)
  @parent_class = parent_class
  @attributes   = attributes

  attributes.each do |attribute|
    evaluator_class.define_attribute(attribute.name, &attribute.to_proc)
  end
end

Instance Method Details

#evaluator_classObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



13
14
15
16
17
18
# File 'lib/factory_girl/evaluator_class_definer.rb', line 13

def evaluator_class
  @evaluator_class ||= Class.new(@parent_class).tap do |klass|
    klass.attribute_lists ||= []
    klass.attribute_lists += [@attributes]
  end
end