Module: Jackal::Utils::Events
- Included in:
- Callback
- Defined in:
- lib/jackal/utils/events.rb
Overview
Event generation helper
Instance Method Summary collapse
-
#event!(type, data = Smash.new) ⇒ NilClass
Send event.
Instance Method Details
#event!(type, data = Smash.new) ⇒ NilClass
Send event
13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/jackal/utils/events.rb', line 13 def event!(type, data=Smash.new) event_source = Carnivore::Supervisor.supervisor[:events] if(event_source) payload = new_payload( :event, :event => Smash.new( :type => type, :stamp => Time.now.to_f, :data => data ) ) debug "Sending event data - type: #{type} ID: #{payload[:id]} data: #{data.inspect}" event_source.transmit(payload) end end |