Module: CLI::UI::Terminal

Defined in:
lib/cli/ui/terminal.rb

Class Method Summary collapse

Class Method Details

.widthObject

Returns the width of the terminal, if possible Otherwise will return 80


10
11
12
13
14
15
16
17
18
# File 'lib/cli/ui/terminal.rb', line 10

def self.width
  if console = IO.respond_to?(:console) && IO.console
    console.winsize[1]
  else
    80
  end
rescue Errno::EIO
  80
end