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.



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

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



2
3
4
# File 'lib/ga_events/event.rb', line 2

def action
  @action
end

#categoryObject

Returns the value of attribute category

Returns:

  • (Object)

    the current value of category



2
3
4
# File 'lib/ga_events/event.rb', line 2

def category
  @category
end

#labelObject

Returns the value of attribute label

Returns:

  • (Object)

    the current value of label



2
3
4
# File 'lib/ga_events/event.rb', line 2

def label
  @label
end

#valueObject

Returns the value of attribute value

Returns:

  • (Object)

    the current value of value



2
3
4
# File 'lib/ga_events/event.rb', line 2

def value
  @value
end

Class Method Details

.from_string(str) ⇒ Object



13
14
15
# File 'lib/ga_events/event.rb', line 13

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

Instance Method Details

#to_sObject



9
10
11
# File 'lib/ga_events/event.rb', line 9

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