Skip to content

Instantly share code, notes, and snippets.

@pzaich
Created June 16, 2012 01:05
Show Gist options
  • Select an option

  • Save pzaich/2939444 to your computer and use it in GitHub Desktop.

Select an option

Save pzaich/2939444 to your computer and use it in GitHub Desktop.
Book Class
class Book
def initialize
end
def title
@book_title
end
def title=(book_title)
lowercase_words = ["in","a","and", "the", "an" ]
book_title = book_title.split(' ')
book_title.collect! do |word|
if lowercase_words.include?(word)
word
else
word.capitalize
end
end
book_title[0].capitalize!
@book_title = book_title.join(' ')
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment