diff options
Diffstat (limited to 'lib/highline')
-rw-r--r-- | lib/highline/menu.rb | 2 | ||||
-rwxr-xr-x | lib/highline/question.rb | 2 | ||||
-rwxr-xr-x | lib/highline/system_extensions.rb | 12 | ||||
-rw-r--r-- | lib/highline/version.rb | 2 |
4 files changed, 11 insertions, 7 deletions
diff --git a/lib/highline/menu.rb b/lib/highline/menu.rb index 636c1e4..44c41b7 100644 --- a/lib/highline/menu.rb +++ b/lib/highline/menu.rb @@ -345,7 +345,7 @@ class HighLine # Allows Menu to behave as a String, just like Question. Returns the # _layout_ to be rendered, which is used by HighLine.say(). # - def to_str( ) + def to_s( ) case @layout when :list '<%= if @header.nil? then '' else "#{@header}:\n" end %>' + diff --git a/lib/highline/question.rb b/lib/highline/question.rb index 10a32dc..fa8445a 100755 --- a/lib/highline/question.rb +++ b/lib/highline/question.rb @@ -441,7 +441,7 @@ class HighLine end # Stringifies the question to be asked. - def to_str( ) + def to_s @question end diff --git a/lib/highline/system_extensions.rb b/lib/highline/system_extensions.rb index 850b043..888d348 100755 --- a/lib/highline/system_extensions.rb +++ b/lib/highline/system_extensions.rb @@ -6,7 +6,6 @@ # This is Free Software. See LICENSE and COPYING for details. require "highline/compatibility" -require "io/console" class HighLine module SystemExtensions @@ -224,9 +223,14 @@ class HighLine # A Unix savvy method using stty to fetch the console columns, and rows. # ... stty does not work in JRuby def terminal_size - if (winsize = IO.console.winsize.reverse rescue nil) - winsize - elsif /solaris/ =~ RUBY_PLATFORM and + begin + require "io/console" + winsize = IO.console.winsize rescue nil + return winsize if winsize + rescue LoadError + end + + if /solaris/ =~ RUBY_PLATFORM and `stty` =~ /\brows = (\d+).*\bcolumns = (\d+)/ [$2, $1].map { |c| x.to_i } elsif `stty size` =~ /^(\d+)\s(\d+)$/ diff --git a/lib/highline/version.rb b/lib/highline/version.rb index 7105c20..d01247e 100644 --- a/lib/highline/version.rb +++ b/lib/highline/version.rb @@ -1,4 +1,4 @@ class HighLine # The version of the installed library. - VERSION = "1.7.0".freeze + VERSION = "1.7.1".freeze end |