class Puppet::Parameter::PackageOptions
This specialized {Puppet::Parameter} handles munging of package options. Package options are passed as an array of key value pairs. Special munging is required as the keys and values needs to be quoted in a safe way.
Public Instance Methods
quote(value)
click to toggle source
@api private
# File lib/puppet/parameter/package_options.rb 29 def quote(value) 30 value.include?(' ') ? %Q["#{value.gsub(/"/, '\"')}"] : value 31 end
unsafe_munge(values)
click to toggle source
# File lib/puppet/parameter/package_options.rb 9 def unsafe_munge(values) 10 values = [values] unless values.is_a? Array 11 12 values.collect do |val| 13 case val 14 when Hash 15 safe_hash = {} 16 val.each_pair do |k, v| 17 safe_hash[quote(k)] = quote(v) 18 end 19 safe_hash 20 when String 21 quote(val) 22 else 23 fail(_("Expected either a string or hash of options")) 24 end 25 end 26 end