lib/qyu/workers/concerns/callback.rb
# Adds a callback option to worker
#
#   callback :execute, :after do
#     # Do something after execution
#   end
#
#   callback :execute, :before do
#     # Do something before execution
#   end
#
#   callback :execute, :around do
#     # Do something around execution
#   end
#
# @param [Symbol] just :execute for now
# @param [Symbol] callback type
# @param [block] block to execute as callback
Adds a callback option to worker
callback :execute, :after do
Do something after execution
end

callback :execute, :before do
Do something before execution
end

callback :execute, :around do
Do something around execution
end
Adds a callback option to worker callback : execute : after do Do something after execution end callback : execute : before do Do something before execution end callback : execute : around do Do something around execution end
def callback(method, type, &block)
          @_callbacks ||= {}
          @_callbacks[method] ||= {}
          @_callbacks[method][type] = block
        end
def callback ( method , type , & block ) @_callbacks ||= { } @_callbacks [ method ] ||= { } @_callbacks [ method ] [ type ] = block end
Adds a callback option to worker
callback :execute, :after do
 Do something after execution
end
Adds a callback option to worker callback : execute : after do Do something after execution end
method
<not_specific>
type
<not_specific>
block
<not_specific>
<not_specific>
block to execute as callback
block to execute as callback