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 28 def quote(value) 29 value.include?(' ') ? %Q["#{value.gsub(/"/, '\"')}"] : value 30 end
unsafe_munge(values)
click to toggle source
# File lib/puppet/parameter/package_options.rb 8 def unsafe_munge(values) 9 values = [values] unless values.is_a? Array 10 11 values.collect do |val| 12 case val 13 when Hash 14 safe_hash = {} 15 val.each_pair do |k, v| 16 safe_hash[quote(k)] = quote(v) 17 end 18 safe_hash 19 when String 20 quote(val) 21 else 22 fail(_("Expected either a string or hash of options")) 23 end 24 end 25 end