Class: FactoryBot::EvaluatorClassDefiner Private
- Inherits:
-
Object
- Object
- FactoryBot::EvaluatorClassDefiner
- Defined in:
- lib/factory_bot/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
- #evaluator_class ⇒ Object private
-
#initialize(attributes, parent_class) ⇒ EvaluatorClassDefiner
constructor
private
A new instance of EvaluatorClassDefiner.
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_bot/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_class ⇒ Object
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_bot/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 |