Skip to content
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

Prevent name collision with private methods from ancestors #351

Merged
merged 6 commits into from Mar 2, 2024

Conversation

vadtel
Copy link
Contributor

@vadtel vadtel commented Feb 13, 2024

I caught error when accessing an option named lambda

>> config['lambda']
# ArgumentError: tried to create Proc object without a block
from bundle/ruby/2.6.0/gems/config-2.2.3/lib/config/options.rb:161:in `lambda'

The methods used to access options are always public, so there is no need to use send. Using send can cause problems because it can call private and protected methods of the base classes. I replaced send with public_send. This will avoid the problems caused by send calling private and protected methods.

@pkuczynski pkuczynski changed the title Fix some problem of name collision with name of private method from ancestors Prevent name collision with private method from ancestors Feb 18, 2024
@pkuczynski pkuczynski changed the title Prevent name collision with private method from ancestors Prevent name collision with private methods from ancestors Feb 18, 2024
@pkuczynski pkuczynski added the bug label Feb 18, 2024
@pkuczynski pkuczynski added this to the Next milestone Feb 18, 2024
@pkuczynski
Copy link
Member

@cjlarose are you happy with the change? I would like to merge it and release it as 5.2.0

@pkuczynski
Copy link
Member

@vadtel tests are failing for Ruby 3.0. Would you mind having a look?

@vadtel
Copy link
Contributor Author

vadtel commented Feb 19, 2024

@vadtel tests are failing for Ruby 3.0. Would you mind having a look?

It depends on the ostruct version
We don't create singleton methods for fields with exclamation marks (bangs) how return respond_to?(name, true) - true
The method_missing method only returns nil in one version of Ruby
ruby/ostruct@69cbbef
May be we need to return "exit!" to constant?

@pkuczynski
Copy link
Member

May be we need to return "exit!" to constant?

Yeah, possibly this would be the easiest solution. @cjlarose wdyt?

@pkuczynski
Copy link
Member

Waiting for the feedback from @cjlarose before we merge it in and release it. Hopefully soon...

@cjlarose cjlarose merged commit 0194f2b into rubyconfig:master Mar 2, 2024
8 checks passed
@cjlarose
Copy link
Member

cjlarose commented Mar 2, 2024

Released with version 5.2.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

Successfully merging this pull request may close these issues.

None yet

3 participants