Module: Migratrix::Callbacks
Overview
Migratrix Callbacks
Callbacks are hooks into the life cycle of a Migratrix Migration or Component object that allow you to trigger logic before or after an alteration of the object state. This can be used to do extra preparation or cleanup at each step along the way. Consider the Migration#migrate
call:
-
(1)
before_migrate
-
(2)
before_extract
-
(-)
extract
-
(3)
after_extract
-
(4)
before_transform
-
(-)
transform
-
(5)
after_transform
-
(6)
before_load
-
(-)
load
-
(7)
after_load
-
(8)
after_migrate
Constant Summary collapse
- CALLBACKS =
[ :after_extract, :after_load, :after_migrate, :after_transform, :around_extract, :around_load, :around_migrate, :around_transform, :before_extract, :before_load, :before_migrate, :before_transform ]
Instance Method Summary collapse
-
#extract ⇒ Object
:nodoc:.
-
#load ⇒ Object
:nodoc:.
-
#migrate ⇒ Object
:nodoc:.
-
#transform ⇒ Object
:nodoc:.
Instance Method Details
#extract ⇒ Object
:nodoc:
44 45 46 |
# File 'lib/migratrix/callbacks.rb', line 44 def extract #:nodoc: run_callbacks(:extract) { super } end |
#load ⇒ Object
:nodoc:
52 53 54 |
# File 'lib/migratrix/callbacks.rb', line 52 def load(*) #:nodoc: run_callbacks(:load) { super } end |
#migrate ⇒ Object
:nodoc:
40 41 42 |
# File 'lib/migratrix/callbacks.rb', line 40 def migrate #:nodoc: run_callbacks(:migrate) { super } end |
#transform ⇒ Object
:nodoc:
48 49 50 |
# File 'lib/migratrix/callbacks.rb', line 48 def transform(*) #:nodoc: run_callbacks(:transform) { super } end |