module-nginx/templates/conf.d/map.erb
Carl P. Corliss fb880576a6 cleanup resultant whitespace and key/value alignment in config files
- fix tests related to whitespace changes
2014-09-13 04:13:18 -04:00

15 lines
381 B
Text

map <%= @string %> $<%= @name %> {
<% if @hostnames -%>
hostnames;
<% end -%>
<% if @default -%>
default <%= @default %>;
<% end -%>
<% if @mappings -%>
<%- field_width = @mappings.inject(0) { |l,(k,v)| k.size > l ? k.size : l } -%>
<%- @mappings.sort_by{|k,v| k}.each do |key,value| -%>
<%= sprintf("%-*s", field_width, key) %> <%= value %>;
<%- end -%>
<% end -%>
}