]> git.openstreetmap.org Git - chef.git/blob - cookbooks/munin/libraries/expand.rb
imagery: add html titles
[chef.git] / cookbooks / munin / libraries / expand.rb
1 class Chef
2   class Munin
3     def self.expand(template, nodes)
4       nodes.map do |node|
5         if node.is_a?(Hash)
6           template.gsub(/%%([^%]+)%%/) { node[Regexp.last_match[1].to_sym] }
7         else
8           template.gsub("%%%", node.tr("-", "_")).gsub("%%", node)
9         end
10       end.join(" ")
11     end
12   end
13 end