Class: CouchbaseOrm::IndexMigration::CommandRecorder

Inherits:
Object
  • Object
show all
Defined in:
lib/couchbase-orm/index_migration/command_recorder.rb

Instance Method Summary collapse

Constructor Details

#initializeCommandRecorder

Returns a new instance of CommandRecorder.



6
7
8
# File 'lib/couchbase-orm/index_migration/command_recorder.rb', line 6

def initialize
  @operations = []
end

Instance Method Details

#record(operation) ⇒ Object



10
11
12
# File 'lib/couchbase-orm/index_migration/command_recorder.rb', line 10

def record(operation)
  @operations << operation
end

#replay_inverse(migration) ⇒ Object



14
15
16
17
18
# File 'lib/couchbase-orm/index_migration/command_recorder.rb', line 14

def replay_inverse(migration)
  @operations.reverse_each do |operation|
    operation.inverse.execute(migration)
  end
end