Closed dervish86 closed 1 year ago
І think we can simplify the issue: If we will add a new test to https://github.com/brainspec/enumerize/blob/master/test/base_test.rb the test fail on ruby 2.7
class BaseTest < MiniTest::Spec
#...
it 'allows initializing object without keyword arguments' do
parent_klass = Class.new do
attr_reader :arguments
def initialize(arguments)
@arguments = arguments
end
end
klass = Class.new(parent_klass) do
extend Enumerize
def initialize(arguments)
super
end
end
params = {'string_key' => 1, symbol_key: 2}
object = klass.new(params)
expect(object.arguments).must_equal params
end
end
I guess the issue might be fixed by replacing https://github.com/brainspec/enumerize/blob/6fa98bfb049f6c761ce7f37f4fdc8a32c22b4502/lib/enumerize/base.rb#L52 with
def initialize(...)
@dervish86 Hey! I just merged a fix (basically your proposed changes), please take a look!
@nashby thank you for resolving the issue! I can confirm that we are no longer seeing the error 🎉
2.6.1 has been released with a fix!
Greetings! We are attempting to upgrade to the latest version of enumerize (2.6.0), but we've encountered an error:
ArgumentError: unknown keyword :some_keyword
. It appears that the current version is not compatible with Ruby 2.7. However, when I ran the script on Ruby 3.0, it worked without any issues.Steps to reproduce
Actual behavior
System configuration
Ruby 2.7.7 Rails 7.0.4.2, 6.1.7.2