29
30
31
32
33
34
35
36
37
38
39
40
41
|
# File 'puppet/modules/wmflib/lib/puppet/parser/functions/ini.rb', line 29
newfunction(:ini, :type => :rvalue, :arity => -2) do |args|
if args.map(&:class).uniq != [Hash]
fail(ArgumentError, 'ini(): hash arguments required')
end
args.reduce(&:merge).map do |section,items|
ini_flatten(items).map do |k, vs|
case vs
when Array then vs.map { |v| "#{k}[#{v}] = #{ini_cast(v)}" }
else "#{k} = #{ini_cast(vs)}"
end
end.flatten.sort.push('').unshift("[#{section}]").join("\n")
end.flatten.sort.push('').join("\n")
end
|