class Soundcloud9000::Events
Public Class Methods
new()
click to toggle source
# File lib/soundcloud9000/events.rb, line 3 def initialize @handlers = Hash.new { |h, k| h[k] = [] } end
Public Instance Methods
on(event, &block)
click to toggle source
# File lib/soundcloud9000/events.rb, line 7 def on(event, &block) @handlers[event] << block end
trigger(event, *args)
click to toggle source
# File lib/soundcloud9000/events.rb, line 11 def trigger(event, *args) @handlers[event].each do |handler| handler.call(*args) end end