class Relayer::IRCEvents
Public Class Methods
new(protocol, client)
click to toggle source
# File lib/relayer/events.rb, line 3 def initialize(protocol, client) @protocol = protocol @client = client @handlers = { :ping => [], :connected => [], :channel_msg => [], :ctcp => [] } end
Public Instance Methods
dispatch(event, args)
click to toggle source
# File lib/relayer/events.rb, line 25 def dispatch(event, args) @handlers[event].each do |handler| handler.call(@protocol, args) end end
method_missing(event, *args, &handler)
click to toggle source
# File lib/relayer/events.rb, line 15 def method_missing(event, *args, &handler) raise ArgumentError if handler.nil? if @handlers.has_key? event @handlers[event].push handler else raise NoMethodError end end