mirror of
https://github.com/mistergibson/gxg-web-client.git
synced 2026-10-19 07:39:44 -07:00
Initial Commit
This commit is contained in:
parent
356ad3315b
commit
81daf6f387
283 changed files with 130672 additions and 1 deletions
23
gxg/standard/io/console/size.rb
Normal file
23
gxg/standard/io/console/size.rb
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
# 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
|
||||
Loading…
Reference in a new issue