Permalink
Browse files

add rb-readline support

  • Loading branch information...
1 parent 7d2a6fe commit 2fc55400a033eee824b631f70001fa188a411334 @cldwalker committed Jan 8, 2011
Showing with 8 additions and 4 deletions.
  1. +8 −4 lib/bond/readline.rb
View
@@ -6,9 +6,13 @@ module Readline
# Loads the readline-like library and sets the completion_proc to the given agent.
def setup(agent)
- require 'readline'
- unless ::Readline.respond_to?(:line_buffer)
- RUBY_PLATFORM =~ /java/ ? load_jruby_extension : load_extension
+ if RUBY_PLATFORM[/mswin|mingw|bccwin|wince/i]
+ require 'rb-readline'
+ else
+ require 'readline'
+ unless ::Readline.respond_to?(:line_buffer)
+ RUBY_PLATFORM =~ /java/i ? load_jruby_extension : load_extension
+ end
end
# Reinforcing irb defaults
@@ -26,7 +30,7 @@ def setup(agent)
def load_jruby_extension
require 'jruby'
- class << Readline
+ class << ::Readline
ReadlineExt = org.jruby.ext.Readline
def line_buffer
ReadlineExt.s_get_line_buffer(JRuby.runtime.current_context, JRuby.reference(self))

0 comments on commit 2fc5540

Please sign in to comment.