Class: FactoryGirl::Proxy::AttributesFor
- Inherits:
-
FactoryGirl::Proxy
- Object
- FactoryGirl::Proxy
- FactoryGirl::Proxy::AttributesFor
- Defined in:
- lib/factory_girl/proxy/attributes_for.rb
Overview
:nodoc:
Instance Attribute Summary
Attributes inherited from FactoryGirl::Proxy
Instance Method Summary collapse
- #get(attribute) ⇒ Object
-
#initialize(klass) ⇒ AttributesFor
constructor
A new instance of AttributesFor.
- #result(to_create) ⇒ Object
- #set(attribute, value, ignored = false) ⇒ Object
Methods inherited from FactoryGirl::Proxy
#add_callback, #associate, #association, #method_missing, #run_callbacks
Constructor Details
#initialize(klass) ⇒ AttributesFor
Returns a new instance of AttributesFor.
4 5 6 7 |
# File 'lib/factory_girl/proxy/attributes_for.rb', line 4 def initialize(klass) @hash = {} @ignored_attributes = {} end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class FactoryGirl::Proxy
Instance Method Details
#get(attribute) ⇒ Object
9 10 11 |
# File 'lib/factory_girl/proxy/attributes_for.rb', line 9 def get(attribute) @ignored_attributes[attribute] || @hash[attribute] end |
#result(to_create) ⇒ Object
21 22 23 |
# File 'lib/factory_girl/proxy/attributes_for.rb', line 21 def result(to_create) @hash end |
#set(attribute, value, ignored = false) ⇒ Object
13 14 15 16 17 18 19 |
# File 'lib/factory_girl/proxy/attributes_for.rb', line 13 def set(attribute, value, ignored = false) if ignored @ignored_attributes[attribute] = value else @hash[attribute] = value end end |