KillerDesigner
12/16/2013 - 5:44 AM

gistfile1.rb

#Create a Book class. You should be able to 
#create a new book and read and write a 
#title for it. When you create a 
#title, it should be converted to title case.

class Book
  attr_accessor :title
  def title=(title)
   book_array = title.split
   caps_array = book_array.each do |caps|
                if caps.length > 1 && caps != "the" && caps != "and" && caps != "or" && caps != "an" && caps != "in"
                   caps.capitalize!
                elsif caps.downcase == "i"
                   caps.capitalize!
                end
                end
   new_book = caps_array.join(" ")
   @title = new_book[0].capitalize << new_book[1..-1]
   p @title
  end
end

book = Book.new
book.title = "a rabbit ran into and hole"