Sha256: 28d71ccb3b6239af4ad20ead7c048762fe99cf345cf8d4bc93dbbb0c0b25ad0c
Contents?: true
Size: 487 Bytes
Versions: 24
Compression:
Stored size: 487 Bytes
Contents
class Reactor::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 end end end
Version data entries
24 entries across 24 versions & 1 rubygems