Class: RubyExt::Callbacks::AroundCallback
- Inherits:
-
AbstractCallback
- Object
- AbstractCallback
- RubyExt::Callbacks::AroundCallback
- 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
127 128 129 130 131 132 133 134 135 |
# File 'lib/ruby_ext/more/callbacks.rb', line 127 def build_block target, method, data, &block -> do if run? target, method, data run target, data, &block else block.call end end end |
#run(target, data, &block) ⇒ Object
137 138 139 140 141 142 143 144 145 |
# File 'lib/ruby_ext/more/callbacks.rb', line 137 def run target, data, &block if executor.is_a? Symbol target.send executor, &block elsif executor.is_a? Proc executor.call target, block else must.be_never_called end end |