class ActiveSupport::Inflector::Inflections
def acronym(word)
underscore 'McDonald' # => 'mcdonald'
acronym 'McDonald'
camelize 'restful_controller' # => 'RESTfulController'
camelize 'restful' # => 'RESTful'
titleize 'RESTfulController' # => 'RESTful Controller'
underscore 'RESTfulController' # => 'restful_controller'
underscore 'RESTful' # => 'restful'
acronym 'RESTful'
restriction is that the word must begin with a capital letter.
otherwise needs to maintain a non-standard capitalization. The only
+acronym+ may be used to specify any word that contains an acronym or
camelize(pluralize('api')) # => 'APIs'
acronym 'APIs'
camelize(pluralize('api')) # => 'Apis'
acronym 'API'
form as an acronym as well:
pluralized result. To work around this, you must specify the pluralized
recognized, since the acronym will not occur as a delimited unit in the
Note: Acronyms that are passed to +pluralize+ will no longer be
underscore 'HTTPS' # => 'https'
camelize 'https' # => 'HTTPS'
acronym 'HTTPS'
underscore 'HTTPS' # => 'http_s', not 'https'
camelize 'https' # => 'Https', not 'HTTPs'
camelize 'my_http_delimited' # => 'MyHTTPDelimited'
acronym 'HTTP'
another word for conversions to recognize it:
The acronym, however, must occur as a delimited unit and not be part of
underscore 'MyHTML' # => 'my_html'
camelize 'html' # => 'HTML'
titleize 'html' # => 'HTML'
acronym 'HTML'
into a non-delimited single lowercase word when passed to +underscore+.
the acronym when titleized or humanized, and will convert the acronym
+titleize+. A camelized string that contains the acronym will maintain
will retain the acronym when passed to +camelize+, +humanize+, or
in a camelized string. An underscore string that contains the acronym
Specifies a new acronym. An acronym must be specified as it will appear
def acronym(word) @acronyms[word.downcase] = word define_acronym_regex_patterns end