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 object traversal #14

Open
gsreynolds opened this issue Jul 6, 2020 · 0 comments
Open

Add object traversal #14

gsreynolds opened this issue Jul 6, 2020 · 0 comments
Labels
Type: Enhancement Adds new functionality.

Comments

@gsreynolds
Copy link
Contributor

gsreynolds commented Jul 6, 2020

https://github.com/chef-customers/inspec-alicloud/blob/a489f34eb6202f0bfe542019e85082786fa435e5/libraries/alicloud_slb_https_listener.rb#L46-L49

inspec/utils/object_traversal is useful for multi level traversal of an object using method_missing, if there are many possible things you might need to check. The core InSpec JSON resource is a good example of this since there's no way of knowing when you write the resource the things that users will need to check. The same magic can be implemented in custom resources using object traversal e.g.

its(%w(SomePolicy OptionA)) { should cmp false }
its(%w(SomePolicy OptionB)) { should cmp false }
its(%w(SomePolicy HashOfOptions OptionZ)) { should cmp false }
@gsreynolds gsreynolds added Type: Enhancement Adds new functionality. and removed enhancement labels Oct 19, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Enhancement Adds new functionality.
Projects
None yet
Development

No branches or pull requests

1 participant