Skip to content

Add has_key? method to OpenStruct class #74

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

djberube
Copy link

Adds has_key? method to OpenStruct class to check if a given name exists as a member, which allows checking for presence of a key without creating an accessor method; it also allows for distinguishing between a method which has never been set and one which been set to nil.

Adds has_key? method to OpenStruct class to check if a given name exists as a member. This allows checking for presence of a key without creating an accessor method. Method accepts both string and symbol keys, converting them to symbols before checking. Includes comprehensive test coverage for various usage scenarios.
@marcandre
Copy link
Member

What is the usecase?

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

Successfully merging this pull request may close these issues.

2 participants