Skip to content

Instantly share code, notes, and snippets.

@danieltreacy
Created March 12, 2012 01:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save danieltreacy/2019015 to your computer and use it in GitHub Desktop.
Save danieltreacy/2019015 to your computer and use it in GitHub Desktop.
Counter v2
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