Skip to content

Instantly share code, notes, and snippets.

@JEG2
Created March 21, 2012 20:28
Show Gist options
  • Select an option

  • Save JEG2/2152552 to your computer and use it in GitHub Desktop.

Select an option

Save JEG2/2152552 to your computer and use it in GitHub Desktop.
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