-
Notifications
You must be signed in to change notification settings - Fork 185
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
dry-initializer: `to_s': wrong number of arguments (1 for 0) #1462
Comments
Thanks - we'll have to dig into the |
@eregon Is possible to look at this issue, please? This issue affects the whole dry-rb/ROM ecosystem. It's some ugly issue with metaprogramming, |
@deepj This variant seems to work fine: require 'dry-initializer'
class Test
extend Dry::Initializer
# param :foo, proc(&:to_s)
param :foo, &:to_s
end
p Test.new(:FOO) |
Mmh, but that's different as it passes a block argument to require 'dry-initializer'
class Test
extend Dry::Initializer
# param :foo, proc(&:to_s)
param :foo, :to_s.to_proc
end
p Test.new(:FOO) also fails. |
This works: require 'dry-initializer'
class Test
extend Dry::Initializer
param :foo, -> obj { obj.to_s }
end
p Test.new(:FOO)
p Test.new(:FOO).foo # => "FOO" The code generated by dry-initializer here differs based on the Proc#arity of a |
@deepj Fix coming. So it might be a MRI bug, on which |
I filed dry-rb/dry-initializer#52. |
* dry-initializer relies on the arity being -1, see #1462 dry-rb/dry-initializer#52
@deepj Fixed, it should be in the next release. Thank you for the report and the ping! |
* dry-initializer relies on the arity being -1, see oracle/truffleruby#1462 dry-rb/dry-initializer#52
This failed under
truffleruby-1.0.0.rc9
. No issue under MRI.Error:
The text was updated successfully, but these errors were encountered: