Created
September 8, 2012 20:24
-
-
Save chaffeqa/3679438 to your computer and use it in GitHub Desktop.
Griff's eyes only
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Check | |
initialize() | |
# do stuff | |
return "completed" | |
end | |
def completed? | |
... | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# SomeWhere else | |
TEAMS = [] | |
TEAMS << Team.new | |
team.checks << "check1" | |
team.checks << "check2" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Scoreboard | |
loop do | |
TEAMS.each do |team| | |
team.on_task_completed do # HOOK THE METHOD | |
puts "Yah finished a check" | |
end | |
end | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Team | |
attr :checks | |
def initialize | |
checks = ['check1','check2'] | |
end | |
def on_check_complete(check) | |
# PASS CHECK TO HOOKED METHODS | |
end | |
def do_checks | |
checks.each do |check| | |
check1 = Check.new(check) | |
end | |
checks.each do |check| | |
if check.completed? | |
on_check_completed(check) | |
end | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment