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

fix(options): Preserve Only and Except Options #182

Closed
wants to merge 1 commit into from
Closed

fix(options): Preserve Only and Except Options #182

wants to merge 1 commit into from

Conversation

Linell
Copy link

@Linell Linell commented Oct 13, 2015

Don't override options[:only] and options[:except] when merging in new options.

Resolves #181

@dblock
Copy link
Member

dblock commented Oct 13, 2015

This seems correct, but we need a test that fails on HEAD currently, please.

@@ -28,6 +28,15 @@ def merge(new_opts)
else
@opts_hash.merge(new_opts)
end

unless opts_hash[:only].nil? || opts_hash[:only].empty?
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you want opts_hash.key?(:only) || ... or assign it to a variable and then check, otherwise you're searching through the hash twice.

@marshall-lee
Copy link
Member

Thanks for your contribution!

@dblock please hold it open for a while, i want to dig it deeper.

@Linell
Copy link
Author

Linell commented Oct 15, 2015

@dblock I made the change that you pointed out.

As far as the test goes, I honestly wouldn't know how to write it for this.

@dblock
Copy link
Member

dblock commented Oct 16, 2015

I'll leave this to @marshall-lee.

@Linell without this fix something breaks in your code, right? Write a test that reproduces the broken behavior without this change.

Don't override `options[:only]` and `options[:except]` when merging in
new options.
@Linell Linell closed this Feb 9, 2022
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.

Only Option Not Correct for Nested Value
3 participants