]> git.openstreetmap.org Git - chef.git/blobdiff - cookbooks/munin/libraries/expand.rb
Fix indentation
[chef.git] / cookbooks / munin / libraries / expand.rb
index 9269761f9ba1fa9d0e212040fc6fd88895f551d4..4dadd14d38dfbc9f53c92ef4d933bd2a23eebeb5 100644 (file)
@@ -1,13 +1,13 @@
 class Chef
   class Munin
     def self.expand(template, nodes)
-      nodes.map do |node| 
-        if node.kind_of?(Hash)
-          template.gsub(/%%([^%]+)%%/) { node[$1.to_sym] }
+      nodes.map do |node|
+        if node.is_a?(Hash)
+          template.gsub(/%%([^%]+)%%/) { node[Regexp.last_match[1].to_sym] }
         else
-          template.gsub("%%", node)
+          template.gsub("%%%", node.tr("-", "_")).gsub("%%", node)
         end
       end.join(" ")
     end
-  end 
+  end
 end