Created
March 21, 2012 20:28
-
-
Save JEG2/2152552 to your computer and use it in GitHub Desktop.
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 TNT | |
| class Timer | |
| def initialize | |
| @time_left = 42 | |
| end | |
| def time_left | |
| @time_left -= 1 | |
| end | |
| end | |
| def initialize | |
| @timer = Timer.new # I don't need TNT::Timer here, because I'm in TNT | |
| end | |
| def are_we_dead_yet? | |
| @timer.time_left <= 0 | |
| end | |
| end | |
| tnt = TNT.new | |
| until tnt.are_we_dead_yet? | |
| puts "Not dead yet!" | |
| end | |
| puts "Now we're dead." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment