Class: DataMigrations::Migration
- Inherits:
-
Object
- Object
- DataMigrations::Migration
- Defined in:
- lib/data_migrations/migration.rb
Instance Attribute Summary collapse
-
#instructions ⇒ Object
readonly
Returns the value of attribute instructions.
-
#source ⇒ Object
readonly
Returns the value of attribute source.
-
#target ⇒ Object
readonly
Returns the value of attribute target.
Instance Method Summary collapse
- #condition(condition = nil) ⇒ Object (also: #where)
- #copy(*args) ⇒ Object
- #exec(*args) ⇒ Object
-
#initialize(source, options = {}) {|_self| ... } ⇒ Migration
constructor
A new instance of Migration.
- #move(*args) ⇒ Object
- #remove(*args) ⇒ Object
- #run! ⇒ Object
- #set(*args) ⇒ Object
Constructor Details
Instance Attribute Details
#instructions ⇒ Object (readonly)
Returns the value of attribute instructions.
3 4 5 |
# File 'lib/data_migrations/migration.rb', line 3 def instructions @instructions end |
#source ⇒ Object (readonly)
Returns the value of attribute source.
3 4 5 |
# File 'lib/data_migrations/migration.rb', line 3 def source @source end |
#target ⇒ Object (readonly)
Returns the value of attribute target.
3 4 5 |
# File 'lib/data_migrations/migration.rb', line 3 def target @target end |
Instance Method Details
#condition(condition = nil) ⇒ Object Also known as: where
17 18 19 |
# File 'lib/data_migrations/migration.rb', line 17 def condition(condition = nil) condition ? @condition = condition : @condition end |
#copy(*args) ⇒ Object
22 23 24 |
# File 'lib/data_migrations/migration.rb', line 22 def copy(*args) instructions << Instruction::Copy.new(self, *args) end |
#exec(*args) ⇒ Object
39 40 41 |
# File 'lib/data_migrations/migration.rb', line 39 def exec(*args) instructions << Instruction::Exec.new(self, *args) end |
#move(*args) ⇒ Object
26 27 28 29 |
# File 'lib/data_migrations/migration.rb', line 26 def move(*args) copy(*args) remove(*args) end |
#remove(*args) ⇒ Object
31 32 33 |
# File 'lib/data_migrations/migration.rb', line 31 def remove(*args) instructions << Instruction::Remove.new(self, *args) end |
#run! ⇒ Object
13 14 15 |
# File 'lib/data_migrations/migration.rb', line 13 def run! instructions.each(&:execute) end |
#set(*args) ⇒ Object
35 36 37 |
# File 'lib/data_migrations/migration.rb', line 35 def set(*args) instructions << Instruction::Set.new(self, *args) end |