class Utter::EventsTable
Public Class Methods
new()
click to toggle source
# File lib/utter.rb, line 11 def initialize @backing_hash = Hash.new { |hash, key| hash[key] = Hash.new { |h, k| h[k] = [] } } end
Public Instance Methods
process_event(object_id, event, payload)
click to toggle source
# File lib/utter.rb, line 19 def process_event(object_id, event, payload) return unless @backing_hash.has_key? object_id return unless @backing_hash[object_id].has_key? event # call registered event handlers @backing_hash[object_id][event].compact! @backing_hash[object_id][event].each do |block| block.call(payload) end # notify watchers changed notify_observers(object_id, event, payload) end