Salut,
I need a selectable hash parameter in my class definition:
class colors (
$flavor = 'myfavorites',
$nice_colors = $flavor ? {
'myfavorites' => {
'red' => false,
'green' => true,
'blue' => false,
},
default => {
'red' => true,
'green' => true,
'blue' => true,
},
},
) inherits colors::params {
Class['colors::install'] -> Class['colors::config']
contain 'colors::install'
contain 'colors::config'
}
Since hash literals can't be specified in a '?'-selector I need to go around this problem.
Later I need to iterate over the hash in a template.
<%- @nice_colors.each do |color, isnice| -%><%- if not isnice %>no<% end %><%= color %><%# -%><%- end -%>
Does anyone have an idea (and when yes, what's your idea?)?
Thx a lot.