Method: Puppet::Property::KeyValue#hashify_should
- Defined in:
- lib/puppet/property/keyvalue.rb
#hashify_should ⇒ Object
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/puppet/property/keyvalue.rb', line 49 def hashify_should # Puppet casts all should values to arrays. Thus, if the user # passed in a hash for our property's should value, the should_value # parameter will be a single element array so we just extract our value # directly. if !@should.empty? && @should.first.is_a?(Hash) return @should.first end # Here, should is an array of key/value pairs. @should.each_with_object({}) do |key_value, hash| tmp = key_value.split(separator) hash[tmp[0].strip.intern] = tmp[1] end end |