Skip to content

Instantly share code, notes, and snippets.

@pjlowry
Created January 30, 2013 19:29
Show Gist options
  • Save pjlowry/4675990 to your computer and use it in GitHub Desktop.
Save pjlowry/4675990 to your computer and use it in GitHub Desktop.
book titles...
class Book
attr_writer :title
def initialize(title)
@title = title
end
def new_book
@title.to_s.split(/ /).map { |e| e.capitalize! }.join(" ")
end
end
book_name = Book.new("bridges over madison county")
puts book_name.new_book
book_name = Book.new("pete's amazing cook book")
puts book_name.new_book
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment