I have been trying to create a titleize method that takes a variable
string and puts that string in titlecase, not capitalizing all the
little words.



This is what I have so far:

def titleize(x)

    "#{x.split.each{|x| x.capitalize!}.join(' ')}"

  end

Example of desired outcome: "On the Road"
Example of current outcome: "On The Road"

I am well aware that this method only capitalizes every word and does
not put little words in lower case.

(Also don't want to use titleize gem)

My question is what code do I have to add in order to get Ruby to
recognize which words are little words and which words aren't?

-- 
Posted via http://www.ruby-forum.com/.