Sha256: 8de891e258c59e132781fe2cbea0c74df8be358811fcc947d8ed48f7979b76d1

Contents?: true

Size: 431 Bytes

Versions: 43

Compression:

Stored size: 431 Bytes

Contents

# frozen_string_literal: false
# fallback to console window size
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
  # returns console window size
  def IO.console_size
    console.winsize
  rescue NoMethodError
    default_console_size
  end
end

Version data entries

43 entries across 42 versions & 7 rubygems

Version Path
trusty-cms-7.0.9.1 vendor/bundle/ruby/3.1.0/gems/io-console-0.7.2/lib/io/console/size.rb
trusty-cms-7.0.9.1 vendor/bundle/ruby/3.3.0/gems/io-console-0.7.2/lib/io/console/size.rb
minato_ruby_api_client-0.2.2 vendor/bundle/ruby/3.2.0/gems/io-console-0.7.2/lib/io/console/size.rb
io-console-0.8.0 lib/io/console/size.rb
io-console-0.8.0-java lib/io/console/size.rb
io-console-0.8.0.beta1 lib/io/console/size.rb
io-console-0.8.0.beta1-java lib/io/console/size.rb
brakeman-6.2.2.rc1 bundle/ruby/3.3.0/gems/io-console-0.7.2/lib/io/console/size.rb
brakeman-6.2.1 bundle/ruby/3.1.0/gems/io-console-0.7.2/lib/io/console/size.rb
brakeman-6.2.0 bundle/ruby/3.1.0/gems/io-console-0.7.2/lib/io/console/size.rb
blacklight-spotlight-3.6.0.beta8 vendor/bundle/ruby/3.2.0/gems/io-console-0.7.2/lib/io/console/size.rb
tinymce-rails-7.1.2 vendor/bundle/ruby/3.3.0/gems/io-console-0.7.2/lib/io/console/size.rb
io-console-0.7.2 lib/io/console/size.rb
io-console-0.7.2-java lib/io/console/size.rb
io-console-0.7.1 lib/io/console/size.rb
io-console-0.7.1-java lib/io/console/size.rb
io-console-0.7.0 lib/io/console/size.rb
io-console-0.7.0-java lib/io/console/size.rb
scrapbook-0.3.2 vendor/ruby/2.7.0/gems/io-console-0.5.11/lib/io/console/size.rb
scrapbook-0.3.1 vendor/ruby/2.7.0/gems/io-console-0.5.11/lib/io/console/size.rb