Module: WipeOut::Plugin::ClassMethods
- Included in:
- WipeOut::Plans::Dsl
- Defined in:
- lib/wipe_out/plugin.rb
Instance Method Summary collapse
- #add_callback(callback) ⇒ Object
- #after(*names, &block) ⇒ Object
- #before(*names, &block) ⇒ Object
- #callback(*names, &block) ⇒ Object
- #callbacks ⇒ Object
Instance Method Details
#add_callback(callback) ⇒ Object
26 27 28 |
# File 'lib/wipe_out/plugin.rb', line 26 def add_callback(callback) callbacks << callback end |
#after(*names, &block) ⇒ Object
12 13 14 |
# File 'lib/wipe_out/plugin.rb', line 12 def after(*names, &block) callback(*names.map { |name| "after_#{name}" }, &block) end |
#before(*names, &block) ⇒ Object
8 9 10 |
# File 'lib/wipe_out/plugin.rb', line 8 def before(*names, &block) callback(*names.map { |name| "before_#{name}" }, &block) end |
#callback(*names, &block) ⇒ Object
16 17 18 19 20 |
# File 'lib/wipe_out/plugin.rb', line 16 def callback(*names, &block) names.each do |name| add_callback(Callback.new(name, block)) end end |
#callbacks ⇒ Object
22 23 24 |
# File 'lib/wipe_out/plugin.rb', line 22 def callbacks @callbacks ||= [] end |