Module: Apache::Apachify

Included in:
String, Symbol
Defined in:
lib/apache/apachify.rb

Instance Method Summary collapse

Instance Method Details

#apachifyObject

Apachify a string

Split the provided name on underscores and capitalize the individual parts Certain character strings are capitalized to match Apache directive names:

  • Cgi => CGI

  • Ssl => SSL

  • Ldap => LDAP



10
11
12
13
14
15
16
17
18
19
20
# File 'lib/apache/apachify.rb', line 10

def apachify
  self.to_s.split("_").collect { |part|
    part.capitalize!

    case part
      when 'Ssl', 'Cgi', 'Ldap', 'Url'; part.upcase
      when 'Etag'; 'ETag'
      else; part
    end
  }.join
end