Class: CassandraSchema::MigrationDSL
- Inherits:
-
Object
- Object
- CassandraSchema::MigrationDSL
- Defined in:
- lib/cassandra-schema/migration.rb
Instance Attribute Summary collapse
-
#migration ⇒ Object
readonly
Returns the value of attribute migration.
Instance Method Summary collapse
- #down(&block) ⇒ Object
- #execute(command) ⇒ Object
-
#initialize(&block) ⇒ MigrationDSL
constructor
A new instance of MigrationDSL.
- #up(&block) ⇒ Object
Constructor Details
#initialize(&block) ⇒ MigrationDSL
Returns a new instance of MigrationDSL.
21 22 23 24 |
# File 'lib/cassandra-schema/migration.rb', line 21 def initialize(&block) @migration = Migration.new instance_eval(&block) end |
Instance Attribute Details
#migration ⇒ Object (readonly)
Returns the value of attribute migration.
19 20 21 |
# File 'lib/cassandra-schema/migration.rb', line 19 def migration @migration end |
Instance Method Details
#down(&block) ⇒ Object
31 32 33 34 |
# File 'lib/cassandra-schema/migration.rb', line 31 def down(&block) @buffer = [] @migration.set_commands(:down, block.call) end |
#execute(command) ⇒ Object
36 37 38 |
# File 'lib/cassandra-schema/migration.rb', line 36 def execute(command) @buffer << command end |
#up(&block) ⇒ Object
26 27 28 29 |
# File 'lib/cassandra-schema/migration.rb', line 26 def up(&block) @buffer = [] @migration.set_commands(:up, block.call) end |