Class: GoogleAnalytics::EventCollection
- Inherits:
-
Object
- Object
- GoogleAnalytics::EventCollection
show all
- Includes:
- Enumerable
- Defined in:
- lib/google-analytics/events/event_collection.rb
Defined Under Namespace
Classes: InvalidEventError
Instance Method Summary
collapse
Constructor Details
Returns a new instance of EventCollection.
13
14
15
|
# File 'lib/google-analytics/events/event_collection.rb', line 13
def initialize
@events = []
end
|
Instance Method Details
#<<(event) ⇒ Object
17
18
19
20
21
|
# File 'lib/google-analytics/events/event_collection.rb', line 17
def <<(event)
raise InvalidEventError.new(event) unless event.is_a?(Event) || event.is_a?(SingleEvent)
@events << event
end
|
#each ⇒ Object
23
24
25
|
# File 'lib/google-analytics/events/event_collection.rb', line 23
def each
@events.each { |e| yield e }
end
|
#length ⇒ Object
Also known as:
size
27
28
29
|
# File 'lib/google-analytics/events/event_collection.rb', line 27
def length
@events.length
end
|