Class: Rubygoal::Goal
- Inherits:
-
Object
- Object
- Rubygoal::Goal
- Defined in:
- lib/rubygoal/goal.rb
Instance Method Summary collapse
- #celebrating? ⇒ Boolean
-
#initialize ⇒ Goal
constructor
A new instance of Goal.
- #start_celebration ⇒ Object
- #update(elapsed_time) ⇒ Object
Constructor Details
#initialize ⇒ Goal
Returns a new instance of Goal.
5 6 7 |
# File 'lib/rubygoal/goal.rb', line 5 def initialize @celebration_time = 0 end |
Instance Method Details
#celebrating? ⇒ Boolean
9 10 11 |
# File 'lib/rubygoal/goal.rb', line 9 def celebration_time > 0 end |
#start_celebration ⇒ Object
13 14 15 |
# File 'lib/rubygoal/goal.rb', line 13 def start_celebration self.celebration_time = 3 end |
#update(elapsed_time) ⇒ Object
17 18 19 20 |
# File 'lib/rubygoal/goal.rb', line 17 def update(elapsed_time) start_celebration unless self.celebration_time -= elapsed_time end |