module EasyIO::Terminal
Public Instance Methods
columns()
click to toggle source
# File lib/easy_io/terminal.rb, line 25 def columns dimensions.last end
dimensions()
click to toggle source
returns [rows, columns]
# File lib/easy_io/terminal.rb, line 12 def dimensions require 'io/console' IO.console.winsize rescue LoadError # This works with older Ruby, but only with systems # that have a tput(1) command, such as Unix clones. [Integer(`tput li`), Integer(`tput co`)] end
interactive?()
click to toggle source
# File lib/easy_io/terminal.rb, line 33 def interactive? $stdout.isatty end
line(filler_character)
click to toggle source
# File lib/easy_io/terminal.rb, line 29 def line(filler_character) filler_character * (Terminal.columns - 1) end
rows()
click to toggle source
# File lib/easy_io/terminal.rb, line 21 def rows dimensions.first end
sync_output()
click to toggle source
Forces real-time output
# File lib/easy_io/terminal.rb, line 6 def sync_output $stdout.sync = true $stderr.sync = true end