sonic-pi
https://github.com/sonic-pi-net/sonic-pi
C++
Code. Music. Live.
ActiveSupport::Inflector::Inflections#acronym
Specifies a new acronym. An acronym must be specified as it will appear
in a camelized string. An underscore string that contains the acronym
will retain the acronym when passed to +camelize+, +humanize+, or
+titleize+. A camelized string that contains the acronym will maintain
the acronym when titleized or humanized, and will convert the acronym
into a non-delimited single lowercase word when passed to +underscore+.
acronym 'HTML'
titleize 'html' # => 'HTML'
camelize 'html' # => 'HTML'
underscore 'MyHTML' # => 'my_html'
The acronym, however, must occur as a delimited unit and not be part of
another word for conversions to recognize it:
acronym 'HTTP'
camelize 'my_http_delimited' # => 'MyHTTPDelimited'
camelize 'https' # => 'Https', not 'HTTPs'
underscore 'HTTPS' # => 'http_s', not 'https'
acronym 'HTTPS'
camelize 'https' # => 'HTTPS'
underscore 'HTTPS' # => 'https'
Note: Acronyms that are passed to +pluralize+ will no longer be
recognized, since the acronym will not occur as a delimited unit in the
pluralized result. To work around this, you must specify the pluralized
form as an acronym as well:
acronym 'API'
camelize(pluralize('api')) # => 'Apis'
acronym 'APIs'
camelize(pluralize('api')) # => 'APIs'
+acronym+ may be used to specify any word that contains an acronym or
otherwise needs to maintain a non-standard capitalization. The only
restriction is that the word must begin with a capital letter.
acronym 'RESTful'
underscore 'RESTful' # => 'restful'
underscore 'RESTfulController' # => 'restful_controller'
titleize 'RESTfulController' # => 'RESTful Controller'
camelize 'restful' # => 'RESTful'
camelize 'restful_controller' # => 'RESTfulController'
acronym 'McDonald'
underscore 'McDonald' # => 'mcdonald'
camelize 'mcdonald' # => 'McDonald'Edit
git clone [email protected]:sonic-pi-net/sonic-pi.git
cd sonic-pi
open app/server/ruby/vendor/activesupport-7.0.6/lib/active_support/inflector/inflections.rb
Contribute
# Make a new branchgit checkout -b -your-name--update-docs-ActiveSupport--Inflector--Inflections-acronym-for-pr
# Commit to gitgit add app/server/ruby/vendor/activesupport-7.0.6/lib/active_support/inflector/inflections.rbgit commit -m "better docs for ActiveSupport::Inflector::Inflections#acronym"
# Open pull requestgem install hub # on a mac you can `brew install hub`
hub fork
git push <your name> -your-name--update-docs-ActiveSupport--Inflector--Inflections-acronym-for-pr
hub pull-request
# Celebrate!