Skip to content

Instantly share code, notes, and snippets.

@jackieiscool
Created June 18, 2012 19:46
Show Gist options
  • Save jackieiscool/2950319 to your computer and use it in GitHub Desktop.
Save jackieiscool/2950319 to your computer and use it in GitHub Desktop.
Book Class
class Book
attr_reader :title
def title=(title)
@title = title.split
@title.each do |word|
a = ["the", "in", "a", "an", "and"]
if a.include?(word.downcase)
word.downcase!
else
word.capitalize!
end
@title[0].capitalize!
end
@title = @title.join(" ")
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment