Class: Segment::Analytics::TestQueue

Inherits:
Object
  • Object
show all
Defined in:
lib/segment/analytics/test_queue.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeTestQueue

Returns a new instance of TestQueue.



8
9
10
# File 'lib/segment/analytics/test_queue.rb', line 8

def initialize
  reset!
end

Instance Attribute Details

#messagesObject (readonly)

Returns the value of attribute messages.



6
7
8
# File 'lib/segment/analytics/test_queue.rb', line 6

def messages
  @messages
end

Instance Method Details

#<<(message) ⇒ Object



20
21
22
23
# File 'lib/segment/analytics/test_queue.rb', line 20

def <<(message)
  all << message
  send(message[:type]) << message
end

#[](key) ⇒ Object



12
13
14
# File 'lib/segment/analytics/test_queue.rb', line 12

def [](key)
  all[key]
end

#aliasObject



25
26
27
# File 'lib/segment/analytics/test_queue.rb', line 25

def alias
  messages[:alias] ||= []
end

#allObject



29
30
31
# File 'lib/segment/analytics/test_queue.rb', line 29

def all
  messages[:all] ||= []
end

#countObject



16
17
18
# File 'lib/segment/analytics/test_queue.rb', line 16

def count
  all.count
end

#groupObject



33
34
35
# File 'lib/segment/analytics/test_queue.rb', line 33

def group
  messages[:group] ||= []
end

#identifyObject



37
38
39
# File 'lib/segment/analytics/test_queue.rb', line 37

def identify
  messages[:identify] ||= []
end

#pageObject



41
42
43
# File 'lib/segment/analytics/test_queue.rb', line 41

def page
  messages[:page] ||= []
end

#reset!Object



53
54
55
# File 'lib/segment/analytics/test_queue.rb', line 53

def reset!
  @messages = {}
end

#screenObject



45
46
47
# File 'lib/segment/analytics/test_queue.rb', line 45

def screen
  messages[:screen] ||= []
end

#trackObject



49
50
51
# File 'lib/segment/analytics/test_queue.rb', line 49

def track
  messages[:track] ||= []
end