Skip to content

Instantly share code, notes, and snippets.

@dcarley
Created January 19, 2012 11:07
Show Gist options
  • Save dcarley/1639440 to your computer and use it in GitHub Desktop.
Save dcarley/1639440 to your computer and use it in GitHub Desktop.
Comparison of foo.is_a?(Array) and [foo].flatten in ERB templates.
<% if not nocache.empty? -%>
# Disable caching for certain locations.
if (req.url ~ "<%= [nocache].flatten.join('" ||
req.url ~ "') -%>") {
return(pass);
}
<% end -%>
<% if not nocache.empty? -%>
# Disable caching for certain locations.
<% if nocache.is_a?(Array) -%>
if (req.url ~ "<%= nocache.join('" ||
req.url ~ "') -%>") {
<% else -%>
if (req.url ~ "<%= nocache -%> ") {
<% end -%>
return(pass);
}
<% end -%>
forwarders { <%= cobbler_dns_forwarders.is_a?(Array) ? cobbler_dns_forwarders.join("; ") : cobbler_dns_forwarders -%>; };
forwarders { <%= [cobbler_dns_forwarders].flatten.join("; ") -%>; };
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment