summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Ries <michael@riesd.com>2015-09-14 14:58:56 -0600
committerMichael Ries <michael@riesd.com>2015-09-14 15:04:40 -0600
commitae93666aa91c94f5dbce15b11abe1dce7b77886e (patch)
tree48c658e3deeb20c909ee227285448c2995c6457f
parent2b0910ad70c2ea555fe453db980bf7ff3da2bea6 (diff)
downloadhighline-ae93666aa91c94f5dbce15b11abe1dce7b77886e.tar.gz
support jruby9k for system extensions
-rwxr-xr-xlib/highline/system_extensions.rb6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/highline/system_extensions.rb b/lib/highline/system_extensions.rb
index 96a39c1..1ea27c4 100755
--- a/lib/highline/system_extensions.rb
+++ b/lib/highline/system_extensions.rb
@@ -12,10 +12,12 @@ class HighLine
JRUBY = defined?(RUBY_ENGINE) && RUBY_ENGINE == 'jruby'
if JRUBY
+ JRUBY_OVER_17 = JRUBY_VERSION =~ /^1.7/ || JRUBY_VERSION =~ /^9/
+
def initialize_system_extensions
require 'java'
require 'readline'
- if JRUBY_VERSION =~ /^1.7/
+ if JRUBY_OVER_17
java_import 'jline.console.ConsoleReader'
input = @input && @input.to_inputstream
@@ -160,7 +162,7 @@ class HighLine
CHARACTER_MODE = "jline" # For Debugging purposes only.
def terminal_size
- if JRUBY_VERSION =~ /^1.7/
+ if JRUBY_OVER_17
[ @java_terminal.get_width, @java_terminal.get_height ]
else
[ @java_terminal.getTerminalWidth, @java_terminal.getTerminalHeight ]