Sha256: a80fd6dfc5f2c8a4b88e090e67198ff94941639f5d0bf73811f9b0d2c40f559d

Contents?: true

Size: 598 Bytes

Versions: 1

Compression:

Stored size: 598 Bytes

Contents

module StrongMigrations
  module Migration
    def initialize(*args)
      super
      @checker = StrongMigrations::Checker.new(self)
    end

    def migrate(direction)
      @checker.direction = direction
      super
    end

    def method_missing(method, *args)
      @checker.perform(method, *args) do
        super
      end
    end

    def safety_assured
      @checker.safety_assured do
        yield
      end
    end

    def stop!(message, header: "Custom check")
      raise StrongMigrations::UnsafeMigration, "\n=== #{header} #strong_migrations ===\n\n#{message}\n"
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
strong_migrations-0.4.1 lib/strong_migrations/migration.rb