Created
January 30, 2013 19:29
-
-
Save pjlowry/4675990 to your computer and use it in GitHub Desktop.
book titles...
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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