Created
February 27, 2017 23:50
-
-
Save jdblack/1eed5d3a5c2d155159447ce5362a462f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Dig | |
def dig(path,default=nil) | |
puts "Entering dig" | |
path.split(".").inject(self) do |l,k| | |
l.respond_to?(:keys) ? (l.to_hash[k] || l.to_hash[k.to_sym] || default):default | |
end | |
end | |
end | |
class Chef::Node | |
include Dig | |
end | |
class Chef::DataBagItem | |
include Dig | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment