class DrunkMonkey::Controller
Public Class Methods
new(name = :default_controller)
click to toggle source
# File lib/drunkmonkey.rb, line 12 def initialize name = :default_controller @handlers = Hash.new Actor[name] = Actor.current end
Public Instance Methods
fire(event, transport, message = nil)
click to toggle source
# File lib/drunkmonkey.rb, line 23 def fire event, transport, message = nil handler = @handlers[event] handler.call transport, message if handler end
on(event, &block)
click to toggle source
# File lib/drunkmonkey.rb, line 17 def on event, &block @handlers[event] = block end