Class: Sequel::MigrationAlterTableReverser

Inherits:
BasicObject
Defined in:
lib/sequel/extensions/migration.rb

Overview

Handles reversing an alter_table block in a reversible migration.

Instance Method Summary collapse

Methods inherited from BasicObject

const_missing

Constructor Details

#initializeMigrationAlterTableReverser

Returns a new instance of MigrationAlterTableReverser.



245
246
247
# File 'lib/sequel/extensions/migration.rb', line 245

def initialize
  @actions = []
end

Instance Method Details

#reverse(&block) ⇒ Object



249
250
251
252
253
254
# File 'lib/sequel/extensions/migration.rb', line 249

def reverse(&block)
  instance_exec(&block)
  actions = @actions.reverse
  # Allow calling private methods as the reversing methods are private
  Proc.new{actions.each{|a| send(*a)}}
end