Class: GAQ::EventCollection
- Inherits:
-
Object
- Object
- GAQ::EventCollection
- Includes:
- Enumerable
- Defined in:
- lib/google_analytics_tools/tracking/events/event_collection.rb
Defined Under Namespace
Classes: InvalidEventError
Instance Method Summary collapse
- #<<(event) ⇒ Object
- #each ⇒ Object
-
#initialize ⇒ EventCollection
constructor
A new instance of EventCollection.
Constructor Details
#initialize ⇒ EventCollection
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
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 |
#each ⇒ Object
23 24 25 |
# File 'lib/google_analytics_tools/tracking/events/event_collection.rb', line 23 def each @events.each { |e| yield e } end |