Class: FactoryGirl::Attribute::Dynamic Private
- Inherits:
-
FactoryGirl::Attribute
- Object
- FactoryGirl::Attribute
- FactoryGirl::Attribute::Dynamic
- Defined in:
- lib/factory_girl/attribute/dynamic.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 Attribute Summary
Attributes inherited from FactoryGirl::Attribute
Instance Method Summary collapse
-
#initialize(name, ignored, block) ⇒ Dynamic
constructor
private
A new instance of Dynamic.
- #to_proc ⇒ Object private
Methods inherited from FactoryGirl::Attribute
Constructor Details
#initialize(name, ignored, block) ⇒ Dynamic
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 Dynamic.
5 6 7 8 |
# File 'lib/factory_girl/attribute/dynamic.rb', line 5 def initialize(name, ignored, block) super(name, ignored) @block = block end |
Instance Method Details
#to_proc ⇒ 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.
10 11 12 13 14 15 16 17 18 |
# File 'lib/factory_girl/attribute/dynamic.rb', line 10 def to_proc block = @block -> { value = block.arity == 1 ? block.call(self) : instance_exec(&block) raise SequenceAbuseError if FactoryGirl::Sequence === value value } end |