Skip to content

Instantly share code, notes, and snippets.

@zilkey
Created October 20, 2010 01:22
Show Gist options
  • Save zilkey/635574 to your computer and use it in GitHub Desktop.
Save zilkey/635574 to your computer and use it in GitHub Desktop.
class MyClass
def self.my_method
100.times do |index|
yield 100, index + 1 if block_given?
end
end
end
MyClass.my_method do |total, index|
$stdout.print "\r"
$stdout.print index
$stdout.print "%"
$stdout.flush
sleep 0.03
end
puts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment