Class: Rad::Callbacks::BeforeCallback

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



78
79
80
81
82
83
84
85
86
87
88
89
90
# File 'lib/rad/support/callbacks.rb', line 78

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