Sha256: dd1f8327122dfae499429c8ebbd4e76822618bf908f078b91d761ee8c0ce48d4
Contents?: true
Size: 566 Bytes
Versions: 7
Compression:
Stored size: 566 Bytes
Contents
module Reactor class Subscriber < ActiveRecord::Base attr_accessor :event def event_name=(event) write_attribute :event_name, event.to_s end def fire(data) self.event = Reactor::Event.new(data) instance_exec &self.class.on_fire self end class << self def on_fire(&block) if block @fire_block = block end @fire_block end def fire(subscriber_id, data) Reactor::Subscriber.find(subscriber_id).fire data.with_indifferent_access end end end end
Version data entries
7 entries across 7 versions & 1 rubygems