Class: Garb::Goal

Inherits:
Object
  • Object
show all
Defined in:
lib/garb/goal.rb,
lib/garb/management/goal.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ Goal

Returns a new instance of Goal.



5
6
7
8
9
10
11
12
13
14
# File 'lib/garb/goal.rb', line 5

def initialize(attributes={})
  return unless attributes.is_a?(Hash)

  @name = attributes['name']
  @number = attributes['number'].to_i
  @value = attributes['value'].to_f
  @active = (attributes['active'] == 'true')

  @destination = Destination.new(attributes[Garb.to_ga('destination')])
end

Instance Attribute Details

#destinationObject (readonly)

Returns the value of attribute destination.



3
4
5
# File 'lib/garb/goal.rb', line 3

def destination
  @destination
end

#nameObject (readonly)

Returns the value of attribute name.



3
4
5
# File 'lib/garb/goal.rb', line 3

def name
  @name
end

#numberObject (readonly)

Returns the value of attribute number.



3
4
5
# File 'lib/garb/goal.rb', line 3

def number
  @number
end

#valueObject (readonly)

Returns the value of attribute value.



3
4
5
# File 'lib/garb/goal.rb', line 3

def value
  @value
end

Instance Method Details

#active?Boolean

Returns:

  • (Boolean)


16
17
18
# File 'lib/garb/goal.rb', line 16

def active?
  @active
end