filter takes two arguments - the data you want to filter, and a whitelisted array of keys you want included. You can capture a subtree of the data to filter by providing a “/”-delimited string of keys. If some key includes “/”-characters, you must provide an array of keys instead.
{ "filesystem" => { "/dev/disk" => { "size" => "10mb" }, "map - autohome" => { "size" => "10mb" } }, "network" => { "interfaces" => { "eth0" => {...}, "eth1" => {...} } } }, ["network/interfaces/eth0", ["filesystem", "/dev/disk"]])
will capture the eth0 and /dev/disk subtrees.
# File lib/chef/whitelist.rb, line 30 def self.filter(data, whitelist=nil) return data if whitelist.nil? new_data = {} whitelist.each do |item| self.add_data(data, new_data, item) end new_data end
Generated with the Darkfish Rdoc Generator 2.