Method: Chef::NodeMap#set
- Defined in:
- lib/chef/node_map.rb
#set(key, value, filters = {}) {|node| ... } ⇒ NodeMap
Set a key/value pair on the map with a filter. The filter must be true when applied to the node in order to retrieve the value.
50 51 52 53 54 55 56 57 58 59 |
# File 'lib/chef/node_map.rb', line 50 def set(key, value, filters = {}, &block) validate_filter!(filters) deprecate_filter!(filters) @map[key] ||= [] # we match on the first value we find, so we want to unshift so that the # last setter wins # FIXME: need a test for this behavior @map[key].unshift({ filters: filters, block: block, value: value }) self end |