Class: Object
- Inherits:
- BasicObject
- Defined in:
- lib/bad_ass_extensions/object.rb
Instance Method Summary collapse
Instance Method Details
#fputs(string) ⇒ Object
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/bad_ass_extensions/object.rb', line 2 def fputs(string) # move cursor to beginning of line cr = "\r" # ANSI escape code to clear line from cursor to end of line # "\e" is an alternative to "\033" # cf. http://en.wikipedia.org/wiki/ANSI_escape_code clear = "\e[0K" # reset lines reset = cr + clear print "#{reset}#{string}" $stdout.flush end |