Class: GaEvents::Event

Inherits:
Struct
  • Object
show all
Defined in:
lib/ga_events/event.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(category = '-', action = '-', label = '-', value = 1) ⇒ Event

Default values are set here, see README.md for details.



6
7
8
9
# File 'lib/ga_events/event.rb', line 6

def initialize(category = '-', action = '-', label = '-', value = 1)
  super
  GaEvents::List << self
end

Instance Attribute Details

#actionObject

Returns the value of attribute action

Returns:

  • (Object)

    the current value of action



4
5
6
# File 'lib/ga_events/event.rb', line 4

def action
  @action
end

#categoryObject

Returns the value of attribute category

Returns:

  • (Object)

    the current value of category



4
5
6
# File 'lib/ga_events/event.rb', line 4

def category
  @category
end

#labelObject

Returns the value of attribute label

Returns:

  • (Object)

    the current value of label



4
5
6
# File 'lib/ga_events/event.rb', line 4

def label
  @label
end

#valueObject

Returns the value of attribute value

Returns:

  • (Object)

    the current value of value



4
5
6
# File 'lib/ga_events/event.rb', line 4

def value
  @value
end

Class Method Details

.from_string(str) ⇒ Object



15
16
17
# File 'lib/ga_events/event.rb', line 15

def self.from_string(str)
  new(*str.split('|'))
end

Instance Method Details

#to_sObject



11
12
13
# File 'lib/ga_events/event.rb', line 11

def to_s
  [category, action, label, value].join('|')
end