Class: Byebug::WidthSetting

Inherits:
Setting
  • Object
show all
Defined in:
lib/byebug/settings/width.rb

Instance Attribute Summary

Attributes inherited from Setting

#value

Instance Method Summary collapse

Methods inherited from Setting

[], []=, #boolean?, boolean?, exists?, find, format, #integer?, integer?, load, settings, #to_sym

Constructor Details

#initializeWidthSetting

Returns a new instance of WidthSetting.



3
4
5
6
7
8
9
10
11
# File 'lib/byebug/settings/width.rb', line 3

def initialize
  if ENV['COLUMNS'] =~ /^\d+$/
    @value = ENV['COLUMNS'].to_i
  elsif STDIN.tty? && exists?('stty')
    @value = `stty size`.scan(/\d+/)[1].to_i
  else
    @value = 160
  end
end

Instance Method Details

#helpObject



13
14
15
# File 'lib/byebug/settings/width.rb', line 13

def help
  "Number of characters per line in byebug's output"
end

#to_sObject



17
18
19
# File 'lib/byebug/settings/width.rb', line 17

def to_s
  "Maximum width of byebug's output is #{value}"
end