Class: Rmap::Migration
- Inherits:
-
Object
- Object
- Rmap::Migration
- Defined in:
- lib/rmap/migration.rb
Instance Attribute Summary collapse
-
#down_block ⇒ Object
Returns the value of attribute down_block.
-
#schema_version ⇒ Object
Returns the value of attribute schema_version.
-
#up_block ⇒ Object
Returns the value of attribute up_block.
Instance Method Summary collapse
- #down(&block) ⇒ Object
-
#initialize(file_path) ⇒ Migration
constructor
A new instance of Migration.
- #up(&block) ⇒ Object
Constructor Details
#initialize(file_path) ⇒ Migration
Returns a new instance of Migration.
7 8 9 10 |
# File 'lib/rmap/migration.rb', line 7 def initialize(file_path) @schema_version = file_path.sub(/\A.*?(\d+)[^\/]*\Z/, "\\1").to_i instance_eval(::File.open(file_path).read, file_path) end |
Instance Attribute Details
#down_block ⇒ Object
Returns the value of attribute down_block.
5 6 7 |
# File 'lib/rmap/migration.rb', line 5 def down_block @down_block end |
#schema_version ⇒ Object
Returns the value of attribute schema_version.
5 6 7 |
# File 'lib/rmap/migration.rb', line 5 def schema_version @schema_version end |
#up_block ⇒ Object
Returns the value of attribute up_block.
5 6 7 |
# File 'lib/rmap/migration.rb', line 5 def up_block @up_block end |
Instance Method Details
#down(&block) ⇒ Object
16 17 18 |
# File 'lib/rmap/migration.rb', line 16 def down(&block) @down_block = block end |
#up(&block) ⇒ Object
12 13 14 |
# File 'lib/rmap/migration.rb', line 12 def up(&block) @up_block = block end |