Created
October 20, 2010 01:22
-
-
Save zilkey/635574 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 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