Class: Redtape::Populator::Abstract
- Inherits:
-
Object
- Object
- Redtape::Populator::Abstract
- Defined in:
- lib/redtape/populator/abstract.rb
Instance Attribute Summary collapse
-
#association_name ⇒ Object
readonly
Returns the value of attribute association_name.
-
#attr_whitelist ⇒ Object
readonly
Returns the value of attribute attr_whitelist.
-
#data_mapper ⇒ Object
readonly
Returns the value of attribute data_mapper.
-
#model ⇒ Object
readonly
Returns the value of attribute model.
-
#parent ⇒ Object
readonly
Returns the value of attribute parent.
-
#pending_attributes ⇒ Object
readonly
Returns the value of attribute pending_attributes.
-
#whitelist_failures ⇒ Object
readonly
Returns the value of attribute whitelist_failures.
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(args = {}) ⇒ Abstract
constructor
A new instance of Abstract.
Constructor Details
#initialize(args = {}) ⇒ Abstract
Returns a new instance of Abstract.
6 7 8 9 10 11 12 13 14 |
# File 'lib/redtape/populator/abstract.rb', line 6 def initialize(args = {}) @model = args[:model] @association_name = args[:association_name] @pending_attributes = args[:attrs] @parent = args[:parent] @data_mapper = args[:data_mapper] @attr_whitelist = args[:attr_whitelist] @whitelist_failures = [] end |
Instance Attribute Details
#association_name ⇒ Object (readonly)
Returns the value of attribute association_name.
4 5 6 |
# File 'lib/redtape/populator/abstract.rb', line 4 def association_name @association_name end |
#attr_whitelist ⇒ Object (readonly)
Returns the value of attribute attr_whitelist.
4 5 6 |
# File 'lib/redtape/populator/abstract.rb', line 4 def attr_whitelist @attr_whitelist end |
#data_mapper ⇒ Object (readonly)
Returns the value of attribute data_mapper.
4 5 6 |
# File 'lib/redtape/populator/abstract.rb', line 4 def data_mapper @data_mapper end |
#model ⇒ Object (readonly)
Returns the value of attribute model.
4 5 6 |
# File 'lib/redtape/populator/abstract.rb', line 4 def model @model end |
#parent ⇒ Object (readonly)
Returns the value of attribute parent.
4 5 6 |
# File 'lib/redtape/populator/abstract.rb', line 4 def parent @parent end |
#pending_attributes ⇒ Object (readonly)
Returns the value of attribute pending_attributes.
4 5 6 |
# File 'lib/redtape/populator/abstract.rb', line 4 def pending_attributes @pending_attributes end |
#whitelist_failures ⇒ Object (readonly)
Returns the value of attribute whitelist_failures.
4 5 6 |
# File 'lib/redtape/populator/abstract.rb', line 4 def whitelist_failures @whitelist_failures end |
Instance Method Details
#call ⇒ Object
16 17 18 19 20 21 22 |
# File 'lib/redtape/populator/abstract.rb', line 16 def call populate_model_attributes(model, pending_attributes) if model.new_record? assign_to_parent end end |