hostclass :class do
items = scope.lookupvar('items_list')
items.each do |item|
file("/etc/init.d/#{item}",
:content => template(['class/item_init.erb']))
end
end
Having this class written in Ruby DSL, how do I properly reference the item
variable in the template? I tried <%= item %>
, <%= @item %>
, <%= scope.lookupvar('item')%>
but none of them work - they all return nil.
UPD
I've found out that it works if inside the loop I define $item_name = item
and then reference it as $item_name
in the template.