/ Published in: Ruby
Don't forget to use require 'directory/nameofclass'
Expand |
Embed | Plain Text
# This helper is opening up core Ruby String class # in order to add a new method to all Strings class String # Ruby has a capitalize method (used below) which capitalizes the # first letter of a string. But in order to capitalize the first # letter of EVERY word we have to write our own. def titleize self.split(' ').collect {|word| word.capitalize}.join(" ") end end
You need to login to post a comment.
