File tree 1 file changed +12
-4
lines changed
1 file changed +12
-4
lines changed Original file line number Diff line number Diff line change @@ -50,21 +50,29 @@ def initialize
50
50
@irb = IRB ::Irb . new ( @workspace )
51
51
@eval_path = @irb . context . irb_path
52
52
IRB . conf [ :MAIN_CONTEXT ] = @irb . context
53
- @completor = IRB ::RegexpCompletor . new
53
+ @completor = IRB ::RegexpCompletor . new if defined? IRB :: RegexpCompletor # IRB::VERSION >= 1.8.2
54
54
end
55
55
56
56
def eval_binding
57
57
@workspace . binding
58
58
end
59
59
60
60
def eval ( code , store_history )
61
- @irb . context . evaluate ( @irb . build_statement ( code ) , 0 )
61
+ if Gem ::Version . new ( IRB ::VERSION ) < Gem ::Version . new ( '1.13.0' )
62
+ @irb . context . evaluate ( code , 0 )
63
+ else
64
+ @irb . context . evaluate ( @irb . build_statement ( code ) , 0 )
65
+ end
62
66
@irb . context . last_value unless IRuby . silent_assignment && assignment_expression? ( code )
63
67
end
64
68
65
69
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 )
70
+ if @completor
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
68
76
end
69
77
70
78
private
You can’t perform that action at this time.
0 commit comments