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

Accessing nested mappings in a yam file #1242

Merged
merged 2 commits into from
Oct 25, 2016
Merged

Accessing nested mappings in a yam file #1242

merged 2 commits into from
Oct 25, 2016

Conversation

chriswessells
Copy link
Contributor

I spent hours following the example in the documentation. When trying to access the nested mappings I received the error "unknown method ". When I read the code from lib/utils/object_traversal.rb I found where keys.shift was used to traverse the object. So I changed from the dotted notation to an array and voila I accessed the nested mapping and could easily verify my tests. I use rubocop for linting so it complained about the [] notation. I updated it to the %w() notation and now pass rubocop linting and my tests were failing correctly but now passing accurately.

…t how to access nested mappings. When I read the code it used keys.shift to traverse the yaml object. I tried changing to an array and voila I was able to access nested mappings. I wanted to document my findngs and suggest an update to inspec.io but couldn't find a place to contact someone for the suggestion.
@chris-rock
Copy link
Contributor

This is related to #875. Thanks for adapting the readme until we've fixed the its implementation.

@chris-rock
Copy link
Contributor

Signed-off-by: Chris Wessells <cwessells@silvervue.com>
@chris-rock chris-rock merged commit 64b3461 into inspec:master Oct 25, 2016
@chris-rock
Copy link
Contributor

Thanks @chriswessells for this docs improvement!

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.

None yet

2 participants