Class: Garb::Goal
- Inherits:
-
Object
- Object
- Garb::Goal
- Defined in:
- lib/garb/goal.rb,
lib/garb/management/goal.rb
Instance Attribute Summary collapse
-
#destination ⇒ Object
readonly
Returns the value of attribute destination.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#number ⇒ Object
readonly
Returns the value of attribute number.
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Instance Method Summary collapse
- #active? ⇒ Boolean
-
#initialize(attributes = {}) ⇒ Goal
constructor
A new instance of Goal.
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
#destination ⇒ Object (readonly)
Returns the value of attribute destination.
3 4 5 |
# File 'lib/garb/goal.rb', line 3 def destination @destination end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
3 4 5 |
# File 'lib/garb/goal.rb', line 3 def name @name end |
#number ⇒ Object (readonly)
Returns the value of attribute number.
3 4 5 |
# File 'lib/garb/goal.rb', line 3 def number @number end |
#value ⇒ Object (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
16 17 18 |
# File 'lib/garb/goal.rb', line 16 def active? @active end |