Sha256: b936f1c6d2500630b218b4b4581d51984fd07eb4bb632c6b09ba1dbe035ebd29

Contents?: true

Size: 579 Bytes

Versions: 2

Compression:

Stored size: 579 Bytes

Contents

# NOTE: Collecting the events is thread-safe, but will cause problems in an
#       asynchronous/evented environment.

module GaEvents::List
  def self.<<(event)
    data << event
  end

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

  def self.present?
    data.present?
  end

  # Init list, optionally with a string of serialized events
  def self.init(str = nil)
    Thread.current[:ga_events] = []
    (str || '').split('$').each { |s| GaEvents::Event.from_string(s) }
  end

  def self.data
    Thread.current[:ga_events]
  end

  private_class_method :data
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
ga_events-1.0.1 lib/ga_events/list.rb
ga_events-1.0.0 lib/ga_events/list.rb