Address Titlecase
Titleize US and Canadian addresses so that states, directions, and other abbreviations that would normally be titlecased by String#titleize
remain uppercase.
> "123 SESAME ST SE, SALEM, OR 97301".address_titlecase
=> "123 Sesame St SE, Salem, OR 97301"
Options
Customize transformations by providing an overrides
argument where the keys denote the words/abbreviations that should be mapped to specific values.
> "123 SESAME ST SE, SALEM, OR 97301".address_titlecase(overrides: { 'ST' => 'ST', 'SE' => 'Se' })
=> "123 Sesame ST Se, Salem, OR 97301"
address_titlecase
is also aliased as address_titleize
.
Installation
Add this line to your application's Gemfile:
gem 'address_titlecase'
And then execute:
$ bundle
Or install it yourself as:
$ gem install address_titlecase
License
The gem is available as open source under the terms of the MIT License.