Created
March 12, 2012 01:00
-
-
Save danieltreacy/2019015 to your computer and use it in GitHub Desktop.
Counter v2
This file contains 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
require 'singleton' | |
module DebtClock | |
class Counter | |
include Singleton | |
def initialize | |
@count = 0 | |
end | |
def start | |
Thread.new { | |
loop do | |
@count += 1 | |
puts "#{@count}\n" | |
sleep 1 | |
end | |
} | |
end | |
def count | |
@count | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment