shreeve / sinatra-rax

A minimal and modern Ruby/IRB console for Sinatra apps
MIT License
4 stars 1 forks source link

routes command fails w/ NoMethodError (undefined method `except' for #<Hash #1

Open jhirbour opened 1 year ago

jhirbour commented 1 year ago

ruby version

2.7.2

OS

Mac Intel Running latest ventura 13.2.1

Gemfile

# frozen_string_literal: true
source 'https://rubygems.org'

gem 'sinatra'
# for irb console in the app use the 'rax' command
gem 'sinatra-rax'

gem 'faraday'
# gem 'newrelic_rpm'
gem 'puma'

group :development do
  gem 'awesome_print'
  gem 'byebug'
  gem 'guard', '2.16.2'
  gem 'guard-rspec', '4.7.3', require: false
  gem 'rack-test', '1.1.0'
  gem 'rake', '13.0.3'
  gem 'rerun', '0.13.1'
  gem 'rspec', '3.10.0'
  gem 'rubocop', '1.10.0', require: false
end

Issue


╰ $ bundle exec rax
2.7.2 :001 > routes
Traceback (most recent call last):
        7: from /Users/johnhirbour/.rvm/gems/ruby-2.7.2@sinatra_app/bin/ruby_executable_hooks:22:in `<main>'
        6: from /Users/johnhirbour/.rvm/gems/ruby-2.7.2@sinatra_app/bin/ruby_executable_hooks:22:in `eval'
        5: from /Users/johnhirbour/.rvm/gems/ruby-2.7.2@sinatra_app/bin/rax:23:in `<main>'
        4: from /Users/johnhirbour/.rvm/gems/ruby-2.7.2@sinatra_app/bin/rax:23:in `load'
        3: from /Users/johnhirbour/.rvm/gems/ruby-2.7.2@sinatra_app/gems/sinatra-rax-1.0/bin/rax:97:in `<top (required)>'
        2: from (development):1
        1: from /Users/johnhirbour/.rvm/gems/ruby-2.7.2@sinatra_app/gems/sinatra-rax-1.0/bin/rax:78:in `routes'
NoMethodError (undefined method `except' for #<Hash:0x00007fa69ca1bec8>)
2.7.2 :002 >
jhirbour commented 1 year ago

Ah except was added in Ruby added except to hashes in Ruby 3.x

https://blog.saeloun.com/2020/09/30/ruby-adds-support-for-hash-except#:~:text=Ruby%20adds%20instance%20method%20%23except,hash%20except%20the%20given%20keys.

Having the min ruby version in the gemspec would have failed better. https://github.com/rubygems/bundler-features/issues/119