Module: GaEvents::List
- Extended by:
- Forwardable
- Defined in:
- lib/ga_events/list.rb
Class Method Summary collapse
-
.init(str = nil) ⇒ Object
Init list, optionally with a string of serialized events.
- .to_s ⇒ Object
Class Method Details
.init(str = nil) ⇒ Object
Init list, optionally with a string of serialized events
19 20 21 22 23 24 25 26 27 |
# File 'lib/ga_events/list.rb', line 19 def init(str = nil) Thread.current[:ga_events] = [] if str.present? raw_events = JSON.parse(str) raw_events.each { |raw_event| GaEvents::Event.from_hash(raw_event) } end rescue JSON::ParserError nil end |
.to_s ⇒ Object
14 15 16 |
# File 'lib/ga_events/list.rb', line 14 def to_s "[#{data.collect(&:to_s).join(',')}]" end |