Class: Crystal::Callbacks::AroundCallback

Inherits:
AbstractCallback show all
Defined in:
lib/crystal/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



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

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