Class: Rad::Callbacks::AfterCallback

Inherits:
AbstractCallback show all
Defined in:
lib/rad/support/callbacks.rb

Instance Attribute Summary

Attributes inherited from AbstractCallback

#conditions, #executor, #terminator

Instance Method Summary collapse

Methods inherited from AbstractCallback

#add_to_chain, #run?, #terminate?

Instance Method Details

#build_block(target, &the_next) ⇒ Object



108
109
110
111
112
113
114
115
116
117
118
119
120
# File 'lib/rad/support/callbacks.rb', line 108

def build_block target, &the_next
  lambda do
    result = if executor.string_or_symbol?
      target.send executor
    elsif executor.is_a? Proc
      executor.call target
    else
      must_be.never_called
    end
  
    the_next.call unless terminate? target, result
  end      
end