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

Add Configuration#dig() and ConfigView#dig() #1221

Merged
merged 1 commit into from Sep 22, 2017

Conversation

gpakosz
Copy link
Member

@gpakosz gpakosz commented Sep 21, 2017

Getting closer to winning your eternal gratitude 😄


# @see Hash#dig
def dig(*keys)
@context.dependency_tracker.bounce(unwrap, attributes: keys)
Copy link
Member

Choose a reason for hiding this comment

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

attributes is a list of top-level attributes that are touched, so this should be keys.first instead. Nanoc only tracks dependencies of keys one level deep.

(keys will also work, but generate unnecessary dependencies.)


context 'with non-existing keys' do
let(:keys) { %i[foo baz bar] }
it { is_expected.to eql(nil) }
Copy link
Member

Choose a reason for hiding this comment

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

Prefer be_nil over eql(nil)

@denisdefreyne denisdefreyne merged commit fbb8f96 into nanoc:master Sep 22, 2017
@denisdefreyne
Copy link
Member

I’ve applied the changes and merged it into master! Thanks for the quick contribution!

@gpakosz
Copy link
Member Author

gpakosz commented Sep 22, 2017

Thanks for the merge!

@gpakosz gpakosz deleted the feature/config-dig branch September 26, 2017 08:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants