lib/strong_migrations/migration.rb in strong_migrations-0.4.1 vs lib/strong_migrations/migration.rb in strong_migrations-0.4.2
- old
+ new
@@ -1,29 +1,30 @@
module StrongMigrations
module Migration
- def initialize(*args)
- super
- @checker = StrongMigrations::Checker.new(self)
- end
-
def migrate(direction)
- @checker.direction = direction
+ strong_migrations_checker.direction = direction
super
end
def method_missing(method, *args)
- @checker.perform(method, *args) do
+ strong_migrations_checker.perform(method, *args) do
super
end
end
def safety_assured
- @checker.safety_assured do
+ strong_migrations_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
+
+ private
+
+ def strong_migrations_checker
+ @strong_migrations_checker ||= StrongMigrations::Checker.new(self)
end
end
end