Permalink
Browse files

Adds end_match method to handle ending a match

  • Loading branch information...
crsven committed Apr 15, 2012
1 parent e0b5dce commit c21f7c2067fe48484659f1ee833905eabe3e97e0
Showing with 7 additions and 4 deletions.
  1. +7 −4 lib/ScoreWatch/match.rb
View
@@ -72,16 +72,14 @@ def get_goal_comment
def get_status
if @game_on == true
if is_over?
- message("Match ended! Final score: #{@home_team} #{current_score} #{@away_team}")
- exit
+ end_match
end
return
elsif is_started?
message("Match has started:\n#{@current_time}: #{@home_team} v. #{@away_team}")
@game_on = true
elsif is_over?
- message("Match ended! Final score: #{@home_team} #{current_score} #{@away_team}")
- exit
+ end_match
else
message("Waiting for match to start.")
end
@@ -117,6 +115,11 @@ def is_over?
end
end
+ def end_match
+ message("Match ended! Final score: #{@home_team} #{@current_score} #{@away_team}")
+ exit
+ end
+
def growl(text)
growl_input = "#{GROWL_OPTIONS} -m '#{text}'"
system("growlnotify #{growl_input}")

0 comments on commit c21f7c2

Please sign in to comment.