module PGTrunk::Operation::Registration

@private Invoke all the necessary definitions in the modules included to Rails via Railtie

Public Instance Methods

from_sql(&block) click to toggle source
Calls superclass method
# File lib/pg_trunk/core/operation/registration.rb, line 11
def from_sql(&block)
  super.tap { register_dumper if block }
end
generates_object(name = nil) click to toggle source
Calls superclass method
# File lib/pg_trunk/core/operation/registration.rb, line 15
def generates_object(name = nil)
  super.tap { register_generator if name }
end
method_added(name) click to toggle source
Calls superclass method
# File lib/pg_trunk/core/operation/registration.rb, line 19
def method_added(name)
  super
ensure
  register_operation if name == :to_sql
  register_inversion if name == :invert
end
register_dumper() click to toggle source
# File lib/pg_trunk/core/operation/registration.rb, line 43
def register_dumper
  PGTrunk::SchemaDumper.register(self)
end
register_generator() click to toggle source
# File lib/pg_trunk/core/operation/registration.rb, line 47
def register_generator
  # skip registration in the runtime
  return unless const_defined?("PGTrunk::Generators")

  PGTrunk::Generators.register(self)
end
register_inversion() click to toggle source
# File lib/pg_trunk/core/operation/registration.rb, line 38
def register_inversion
  # Record the inversion of the operation
  PGTrunk::CommandRecorder.register_inversion(self)
end
register_operation() click to toggle source
# File lib/pg_trunk/core/operation/registration.rb, line 28
def register_operation
  # Add the method to statements as an entry point
  PGTrunk::Statements.register(self)
  # Add the shortcut to migration go get away with checking
  # of the first parameter which could be NOT a table name.
  PGTrunk::Migration.register(self)
  # Record the direct operation
  PGTrunk::CommandRecorder.register(self)
end