# File lib/genome-dsl/machines.rb, line 72 def external_node_yaml(hostname) # acc, or Accumulator is the best match so far machine = machines.inject(machines.first) do |acc, m| # Find the regex that matches the most characters if m.matching_chars(hostname) > acc.matching_chars(hostname) acc = m end acc # return end #At this point we either have the best match, #or we have no match at all if machine.matches?(hostname) h = Hash.new h["classes"] = machine.classes h["parameters"] = machine.parameters return YAML::dump(h) else return YAML::dump([]) end end