Class: GoogleAnalytics::EventCollection

Inherits:
Object
  • Object
show all
Includes:
Enumerable
Defined in:
lib/google-analytics/events/event_collection.rb

Defined Under Namespace

Classes: InvalidEventError

Instance Method Summary (collapse)

Constructor Details

- (EventCollection) initialize

A new instance of EventCollection



11
12
13
# File 'lib/google-analytics/events/event_collection.rb', line 11

def initialize
  @events = []
end

Instance Method Details

- (Object) <<(event)

Raises:



15
16
17
18
19
# File 'lib/google-analytics/events/event_collection.rb', line 15

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

  @events << event
end

- (Object) each



21
22
23
# File 'lib/google-analytics/events/event_collection.rb', line 21

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