Sha256: 0f6c2de5323a52bb794a9a31bc8fe754469729d1be01a9d32c8e6db6b725e194

Contents?: true

Size: 331 Bytes

Versions: 4

Compression:

Stored size: 331 Bytes

Contents

def IO.default_console_size
  [
    ENV["LINES"].to_i.nonzero? || 25,
    ENV["COLUMNS"].to_i.nonzero? || 80,
  ]
end

begin
  require 'io/console'
rescue LoadError
  class IO
    alias console_size default_console_size
  end
else
  def IO.console_size
    console.winsize
  rescue NoMethodError
    default_console_size
  end
end

Version data entries

4 entries across 4 versions & 2 rubygems

Version Path
rubysl-io-console-2.0.0 lib/io/console/size.rb
io-console-0.4.2 lib/console/size.rb
io-console-0.4.1 lib/console/size.rb
io-console-0.3 lib/console/size.rb