apache-config-generator/lib/apache/core_ext/array.rb
2011-09-27 15:30:38 -04:00

41 lines
624 B
Ruby

# Ruby arrays
class Array
# Apachify all the elements within this array
def apachify
self.collect(&:apachify)
end
def quoteize
self.collect(&:quoteize)
end
def quoteize!
self.collect!(&:quoteize)
end
def blockify
self.quoteize * " "
end
alias :commentize :to_a
def headerize
"#{self.first.quoteize} #{self.last}"
end
def rewrite_cond_optionify
self.collect do |opt|
{
:or => 'OR',
:case_insensitive => 'NC',
:no_vary => 'NV'
}[opt]
end
end
def rewrite_option_listify
(!self.empty?) ? "[#{self * ','}]" : nil
end
end