Skip to content

Commit

Permalink
Fix NoMethodError in backend (#364)
Browse files Browse the repository at this point in the history
- IRB v1.15.0 renamed build_statement -> parse_input
  • Loading branch information
edsinclair authored Jan 24, 2025
1 parent a57ac66 commit bb7f658
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions lib/iruby/backend.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit bb7f658

Please sign in to comment.