File tree Expand file tree Collapse file tree 1 file changed +12
-4
lines changed Expand file tree Collapse file tree 1 file changed +12
-4
lines changed Original file line number Diff line number Diff line change @@ -50,21 +50,29 @@ def initialize
5050 @irb = IRB ::Irb . new ( @workspace )
5151 @eval_path = @irb . context . irb_path
5252 IRB . conf [ :MAIN_CONTEXT ] = @irb . context
53- @completor = IRB ::RegexpCompletor . new
5453 end
5554
5655 def eval_binding
5756 @workspace . binding
5857 end
5958
6059 def eval ( code , store_history )
61- @irb . context . evaluate ( @irb . build_statement ( code ) , 0 )
60+ if Gem ::Version . new ( IRB ::VERSION ) < Gem ::Version . new ( '1.13.0' )
61+ @irb . context . evaluate ( code , 0 )
62+ else
63+ @irb . context . evaluate ( @irb . build_statement ( code ) , 0 )
64+ end
6265 @irb . context . last_value unless IRuby . silent_assignment && assignment_expression? ( code )
6366 end
6467
6568 def complete ( code )
66- # preposing and postposing never used, so they are empty, pass only target as code
67- @completor . completion_candidates ( '' , code , '' , bind : @workspace . binding )
69+ if defined? IRB ::RegexpCompletor # IRB::VERSION >= 1.8.2
70+ completor = IRB ::RegexpCompletor . new
71+ # preposing and postposing never used, so they are empty, pass only target as code
72+ completor . completion_candidates ( '' , code , '' , bind : @workspace . binding )
73+ else
74+ IRB ::InputCompletor ::CompletionProc . call ( code )
75+ end
6876 end
6977
7078 private
You can’t perform that action at this time.
0 commit comments