Module: Lifestreamable::Lifestreamer

Defined in:
lib/lifestreamable/lifestreamer.rb

Overview

:title: module Lifestreamable::Lifestreamer Module that generates the lifestream. this is done as an after_filter that is added to ActionController::Base. Hence any action that is called in the controller will call this function afterwards. The Lifestreamable::Lifestreamer.generate_lifestream has a very small footprint when it has nothign to do.

TODO, include support for delayed_jobs to do it asynchronously

Constant Summary collapse

@@stack =
[]

Class Method Summary collapse

Class Method Details

.clearObject



24
25
26
# File 'lib/lifestreamable/lifestreamer.rb', line 24

def self.clear
  @@stack.clear
end

.generate_lifestreamObject



14
15
16
17
18
19
20
21
22
23
# File 'lib/lifestreamable/lifestreamer.rb', line 14

def self.generate_lifestream
  while (lifestream_entry=@@stack.shift)
    begin
      Lifestream.process(lifestream_entry[0], lifestream_entry[1])
    rescue Exception => e
      puts e.message, e.backtrace
      # TODO PUT SOMETHING HERE!!!
    end
  end
end

.inspectObject



27
28
29
# File 'lib/lifestreamable/lifestreamer.rb', line 27

def self.inspect
  @@stack.inspect
end

.push(action, lifestream_struct) ⇒ Object



10
11
12
13
# File 'lib/lifestreamable/lifestreamer.rb', line 10

def self.push(action, lifestream_struct)
  @@stack.push [action, lifestream_struct]
  @@stack.uniq!
end