Class: RubyExt::Callbacks::AfterCallback
- Inherits:
-
AbstractCallback
- Object
- AbstractCallback
- RubyExt::Callbacks::AfterCallback
- Defined in:
- lib/ruby_ext/more/callbacks.rb
Instance Attribute Summary
Attributes inherited from AbstractCallback
Instance Method Summary collapse
Methods inherited from AbstractCallback
Instance Method Details
#build_block(target, method, data, &block) ⇒ Object
103 104 105 106 107 108 109 110 111 112 113 |
# File 'lib/ruby_ext/more/callbacks.rb', line 103 def build_block target, method, data, &block -> do if run? target, method, data result = block.call run target, data result else block.call end end end |
#run(target, data) ⇒ Object
115 116 117 118 119 120 121 122 123 |
# File 'lib/ruby_ext/more/callbacks.rb', line 115 def run target, data if executor.is_a? Symbol target.send executor elsif executor.is_a? Proc executor.call target else must.be_never_called end end |