Class: Migratrix::Loads::Load

Inherits:
Object
  • Object
show all
Includes:
Migratrix::Loggable, ValidOptions
Defined in:
lib/migratrix/loads/load.rb

Direct Known Subclasses

Yaml

Instance Attribute Summary collapse

Instance Method Summary collapse

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, options={})
  @name = name
  @options = options.symbolize_keys
end

Instance Attribute Details

#nameObject

Returns the value of attribute name.



7
8
9
# File 'lib/migratrix/loads/load.rb', line 7

def name
  @name
end

#optionsObject

Returns the value of attribute options.



7
8
9
# File 'lib/migratrix/loads/load.rb', line 7

def options
  @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

#transformObject

Name of the transform to use. If omitted, returns our name.



24
25
26
# File 'lib/migratrix/loads/load.rb', line 24

def transform
  options[:transform] || name
end