title_case

A ruby gem consisting of String methods to title case strings, including a command-line demonstration utility.

Installation

gem install title_case

or, if you want the latest and the greatest, or if you want the man page installed:

git clone https://github.com/nbirnel/titlecase
cd titlecase
rake install

(use sudo as necessary)

Runtime Requirements

ruby >= 1.9.2

Build Requirements

rake

Developer Requirements

groff

Inspiration and History

This is partially inspired and informed by John Gruber's titlecase: http://daringfireball.net/2008/05/title_case and Sam Souder's ruby implementation: https://github.com/samsouder/titlecase

I didn't like a few of the rules in Gruber's version, though. Major differences are:

  • don't ever downcase anything
  • the last word doesn't get upcased if it is on the exclude list
  • the exclude list is slightly different
  • colons get no special treatment

License

© 2014 Noah Birnel MIT license

Build Status Code Climate Gem Version

Man page

titlecase

titlecase

NAME
SYNOPSIS
DESCRIPTION
OPTIONS
EXAMPLES
SEE ALSO
BUGS
LICENSE


NAME

titlecase − capitalize a phrase like a newspaper editor would

SYNOPSIS

titlecase [FILE]

DESCRIPTION

titlecase converts a byte-stream to title-casing — the first letter of most words is converted to upper-case. Exceptions are:

words that already have some capitalization (Jones, AT&T, iPhone) or numbers (x0xb0x, left4dead)

a list of short (less than 4 characters) conjunctions, prepositions, and articles; unless they are at the beginning of the byte-stream

OPTIONS

none

EXAMPLES

echo ’old McDonald had a farm’ | titlecase

Old McDonald Had a Farm

SEE ALSO

ruby(1)
http://daringfireball.net/2008/05/title_case
http://rubygems.org/gems/titlecase

BUGS

Capitalizes Dutch abbreviations ’s, ’t, ’n. Probably others.

LICENSE

Copyright 2014 Noah Birnel

MIT license