Module: Bundler::Thor::Shell::Terminal

Defined in:
lib/bundler/vendor/thor/lib/thor/shell/terminal.rb

Constant Summary collapse

DEFAULT_TERMINAL_WIDTH =
80

Class Method Summary collapse

Class Method Details

.terminal_widthObject

This code was copied from Rake, available under MIT-LICENSE Copyright © 2003, 2004 Jim Weirich



9
10
11
12
13
14
15
16
17
18
# File 'lib/bundler/vendor/thor/lib/thor/shell/terminal.rb', line 9

def terminal_width
  result = if ENV["THOR_COLUMNS"]
    ENV["THOR_COLUMNS"].to_i
  else
    unix? ? dynamic_width : DEFAULT_TERMINAL_WIDTH
  end
  result < 10 ? DEFAULT_TERMINAL_WIDTH : result
rescue
  DEFAULT_TERMINAL_WIDTH
end

.unix?Boolean

Returns:

  • (Boolean)


20
21
22
# File 'lib/bundler/vendor/thor/lib/thor/shell/terminal.rb', line 20

def unix?
  RUBY_PLATFORM =~ /(aix|darwin|linux|(net|free|open)bsd|cygwin|solaris)/i
end