class ActsAsHasselhoff::PutsSlowly
Attributes
strang[R]
Public Class Methods
new(strang)
click to toggle source
# File lib/acts_as_hasselhoff/puts_slowly.rb, line 5 def initialize(strang) @strang = strang end
Public Instance Methods
run(speed = 5.0)
click to toggle source
# File lib/acts_as_hasselhoff/puts_slowly.rb, line 9 def run(speed = 5.0) thr = Thread.new do @strang.length.times do |i| print "\r#{@strang[0..i]}" sleep(rand / speed) STDOUT.flush end end thr.run end