Module: GaEvents::List

Defined in:
lib/ga_events/list.rb

Overview

NOTE: Collecting the events is thread-safe, but will cause problems in an

asynchronous/evented environment.

Class Method Summary collapse

Class Method Details

.<<(event) ⇒ Object



5
6
7
# File 'lib/ga_events/list.rb', line 5

def self.<<(event)
  data << event
end

.init(str = nil) ⇒ Object

Init list, optionally with a string of serialized events



18
19
20
21
# File 'lib/ga_events/list.rb', line 18

def self.init(str = nil)
  Thread.current[:ga_events] = []
  (str || '').split('$').each { |s| GaEvents::Event.from_string(s) }
end

.present?Boolean

Returns:

  • (Boolean)


13
14
15
# File 'lib/ga_events/list.rb', line 13

def self.present?
  data.present?
end

.to_sObject



9
10
11
# File 'lib/ga_events/list.rb', line 9

def self.to_s
  data.collect(&:to_s).join('$')
end