Class: GAQ::EventCollection

Inherits:
Object
  • Object
show all
Includes:
Enumerable
Defined in:
lib/google_analytics_tools/tracking/events/event_collection.rb

Defined Under Namespace

Classes: InvalidEventError

Instance Method Summary collapse

Constructor Details

#initializeEventCollection

Returns a new instance of EventCollection.


13
14
15
# File 'lib/google_analytics_tools/tracking/events/event_collection.rb', line 13

def initialize
  @events = []
end

Instance Method Details

#<<(event) ⇒ Object

Raises:


17
18
19
20
21
# File 'lib/google_analytics_tools/tracking/events/event_collection.rb', line 17

def <<(event)
  raise InvalidEventError.new(event) unless event.is_a?(GAQ::Event)

  @events << event
end

#eachObject


23
24
25
# File 'lib/google_analytics_tools/tracking/events/event_collection.rb', line 23

def each
  @events.each { |e| yield e }
end