New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
pretty_generate: maybe ** should be added to state.generate #414
Comments
Sorry for the delay in responding. Thanks for bringing this up. This is a complex issue. tldnr: One solution for you (using current 2.3.0 release) is to use the following: def to_json(state = {})
@table.to_json(**state)
end This bug should be fixed though. I'm summarizing my findings here: Firstly, the stacktrace points to It's super unclear from the code or the documentation, but currently all calls Now the tricky part is that def foo(*args, **options)
p args, options
end
state = JSON::Ext::Generator::State.new
foo(state) # => [], {:indent=>"", :space=>"", :space_before=>"", ... That is, In Ruby 3.0 that won't work and I'm a bit out of touch with the threads on keyword conversion (it makes me cringe a bit when I read them), but I think that calling so I'm not sure exactly if it's possible / a good idea or how efficient it would be to call This is further complicated by my ignorance of the state of affairs in the java world; maybe @headius can help on the JRuby side, assuming they are following MRI on keyword conversion... |
All I was trying to do is effectively delegate |
Just to be clear, I haven't checked the def to_json(*args)
@table.to_json(*args)
end |
|
json/lib/json/common.rb
Line 289 in da50acc
Ruby 2.7.1 says
warning: Using the last argument as keyword parameters is deprecated; maybe ** should be added to the call
for some receivers. (In my case for a class that hasdef to_json *args, **named; (@table.to_json *args, **named); end
)The text was updated successfully, but these errors were encountered: