Module: Falconer

Defined in:
lib/falconer.rb,
lib/falconer/version.rb,
lib/falconer/class_methods.rb

Defined Under Namespace

Modules: Rails, Store Classes: Rack

Constant Summary collapse

ACCEPT_HEADER =
'x-falconer-accept-events'
EVENTS_HEADER =
'x-falconer-events'
ACCEPT_HEADER_ENV =
"HTTP_#{ACCEPT_HEADER.upcase.gsub('-','_')}"
VERSION =
'0.0.5'

Class Method Summary collapse

Class Method Details

.flushArray

Returns all queued events and empties queue

Returns:

  • (Array)

    list of event tuples ([event, data])



17
18
19
20
21
# File 'lib/falconer/class_methods.rb', line 17

def flush
  returned_events = store.events
  store.clear_events
  returned_events
end

.trigger(event, data) ⇒ Object

Triggers a new event to be sent to the Falconer Client

Parameters:

  • event (String)

    the name of the event to be triggered

  • data (Object)

    the data associated with the event This data will be transimitted through JSON encoding



9
10
11
# File 'lib/falconer/class_methods.rb', line 9

def trigger(event, data)
  store.add_event(event, data)
end