Skip to content

Commit bb7f658

Browse files
authored
Fix NoMethodError in backend (#364)
- IRB v1.15.0 renamed build_statement -> parse_input
1 parent a57ac66 commit bb7f658

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

Diff for: lib/iruby/backend.rb

+7-5
Original file line numberDiff line numberDiff line change
@@ -58,14 +58,16 @@ def eval_binding
5858
end
5959

6060
def eval(code, store_history)
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
61+
@irb.context.evaluate(parse_code(code), 0)
6662
@irb.context.last_value unless IRuby.silent_assignment && assignment_expression?(code)
6763
end
6864

65+
def parse_code(code)
66+
return code if Gem::Version.new(IRB::VERSION) < Gem::Version.new('1.13.0')
67+
return @irb.parse_input(code) if @irb.respond_to?(:parse_input)
68+
return @irb.build_statement(code) if @irb.respond_to?(:build_statement)
69+
end
70+
6971
def complete(code)
7072
if @completor
7173
# preposing and postposing never used, so they are empty, pass only target as code

0 commit comments

Comments
 (0)