class Bizflow::Lib::CallbackHandler

Attributes

callbacks[RW]

Public Class Methods

new() click to toggle source
# File lib/bizflow/lib/callback_handler.rb, line 7
def initialize
  @callbacks = {}
end

Public Instance Methods

callback(name, *args) click to toggle source
# File lib/bizflow/lib/callback_handler.rb, line 16
def callback(name, *args)
  raise "Callback '#{name}' not registered" unless @callbacks[name.to_sym]
  @callbacks[name.to_sym].call(args[0])
end
clear() click to toggle source
# File lib/bizflow/lib/callback_handler.rb, line 21
def clear
  @callbacks.clear()
end
method_missing(name, *args, &block) click to toggle source
# File lib/bizflow/lib/callback_handler.rb, line 11
def method_missing(name, *args, &block)
  raise "Callback #{name} registered more times" if @callbacks[name.to_sym]
  @callbacks[name.to_sym] = block
end