]> git.openstreetmap.org Git - chef.git/blob - cookbooks/munin/libraries/expand.rb
Decrease tile rate limit to 30 TPS
[chef.git] / cookbooks / munin / libraries / expand.rb
1 class Chef
2   class Munin
3     def self.expand(template, nodes, separator = " ")
4       nodes.map do |node|
5         if node.is_a?(Hash)
6           template
7             .gsub(/%%%([^%]+)%%%/) { node[Regexp.last_match[1].to_sym].tr("-", "_") }
8             .gsub(/%%([^%]+)%%/) { node[Regexp.last_match[1].to_sym] }
9         else
10           template
11             .gsub("%%%", node.tr("-", "_"))
12             .gsub("%%", node)
13         end
14       end.join(separator)
15     end
16   end
17 end