Class: Migratrix::Loads::Load
- Includes:
- Migratrix::Loggable, ValidOptions
- Defined in:
- lib/migratrix/loads/load.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#name ⇒ Object
Returns the value of attribute name.
-
#options ⇒ Object
Returns the value of attribute options.
Instance Method Summary collapse
-
#initialize(name, options = {}) ⇒ Load
constructor
A new instance of Load.
-
#load(transformed_objects) ⇒ Object
Default strategy: call save() on every transformed_object.
-
#transform ⇒ Object
Name of the transform to use.
Constructor Details
#initialize(name, options = {}) ⇒ Load
Returns a new instance of Load.
11 12 13 14 |
# File 'lib/migratrix/loads/load.rb', line 11 def initialize(name, ={}) @name = name @options = .symbolize_keys end |
Instance Attribute Details
#name ⇒ Object
Returns the value of attribute name.
7 8 9 |
# File 'lib/migratrix/loads/load.rb', line 7 def name @name end |
#options ⇒ Object
Returns the value of attribute options.
7 8 9 |
# File 'lib/migratrix/loads/load.rb', line 7 def @options end |
Instance Method Details
#load(transformed_objects) ⇒ Object
Default strategy: call save() on every transformed_object.
17 18 19 20 21 |
# File 'lib/migratrix/loads/load.rb', line 17 def load(transformed_objects) transformed_objects.each do |transformed_object| transformed_object.save end end |
#transform ⇒ Object
Name of the transform to use. If omitted, returns our name.
24 25 26 |
# File 'lib/migratrix/loads/load.rb', line 24 def transform [:transform] || name end |