Skip to content
Ruby library: adds String#titleize to properly capitalize titles
Branch: master
Clone or download
Latest commit 185a433 Sep 16, 2016
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
lib bump version to 1.4.1 Sep 16, 2016
spec correctly match the first and last words Sep 16, 2016
.gitignore
Gemfile use bundler for gem management (bump to 1.2.1) Apr 15, 2011
History.txt bump version to 1.4.1 Sep 16, 2016
README.md Updating README Feb 21, 2013
Rakefile update rspec to 2.13 Mar 8, 2013
titleize.gemspec

README.md

Titleize

http://rubygems.org/gems/titleize

Description

Adds String#titleize for creating properly capitalized titles. It can be called as Titleize.titleize or "a string".titleize. It is also aliased as titlecase.

The list of "small words" which are not capped comes from the New York Times Manual of Style, plus 'vs' and 'v'.

If loaded in a Rails environment, it modifies Inflector#titleize. By default ActiveSupport calls Inflector#underscore and Inflector#humanize. This however can be problematic with words like "iPod", "GPS", and "McArthur". To disable this behavior, use the options :underscore => false and :humanize => false.

Based on TitleCase.pl by John Gruber.

Synopsis

"a lovely and talented title".titleize # => "A Lovely and Talented Title"

Install

gem install titleize

License

(The MIT License)

Copyright (c) 2008 Grant Hollingworth

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

You can’t perform that action at this time.