Skip to content

Instantly share code, notes, and snippets.

@Solnse
Created December 14, 2012 06:32
Show Gist options
  • Save Solnse/4283166 to your computer and use it in GitHub Desktop.
Save Solnse/4283166 to your computer and use it in GitHub Desktop.
def titleize(word)
words = []
result = ""
words = word.split
num = words.count
while num > 0
words.each do |word|
word.capitalize!
result << word
result << " " unless num <= 1
end
num -= 1
end
return result
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment