From a8bdae06f305be1b2e087709c74811d2e4ed54a1 Mon Sep 17 00:00:00 2001 From: Eirik Dentz Sinclair Date: Thu, 23 Jan 2025 16:15:05 +0100 Subject: [PATCH] Fix NoMethodError in backend - IRB v1.15.0 renamed build_statement -> parse_input --- lib/iruby/backend.rb | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/lib/iruby/backend.rb b/lib/iruby/backend.rb index a8b17ef..523f5e4 100644 --- a/lib/iruby/backend.rb +++ b/lib/iruby/backend.rb @@ -58,14 +58,16 @@ def eval_binding end def eval(code, store_history) - if Gem::Version.new(IRB::VERSION) < Gem::Version.new('1.13.0') - @irb.context.evaluate(code, 0) - else - @irb.context.evaluate(@irb.build_statement(code), 0) - end + @irb.context.evaluate(parse_code(code), 0) @irb.context.last_value unless IRuby.silent_assignment && assignment_expression?(code) end + def parse_code(code) + return code if Gem::Version.new(IRB::VERSION) < Gem::Version.new('1.13.0') + return @irb.parse_input(code) if @irb.respond_to?(:parse_input) + return @irb.build_statement(code) if @irb.respond_to?(:build_statement) + end + def complete(code) if @completor # preposing and postposing never used, so they are empty, pass only target as code