Skip to content

Instantly share code, notes, and snippets.

@Fokusnica
Created June 27, 2015 17:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Fokusnica/41d9de46b96a537def52 to your computer and use it in GitHub Desktop.
Save Fokusnica/41d9de46b96a537def52 to your computer and use it in GitHub Desktop.
Additional practice Edition
class Edition
# :book, :year_of_publishing, :number_of_pages
attr_writer :book, :year_of_publishing, :number_of_pages
attr_reader :book, :year_of_publishing, :number_of_pages
def initialize (book = nil, year_of_publishing = nil, number_of_pages = nil)
@book =book.to_s
@year_of_publishing=year_of_publishing.to_i
@number_of_pages = number_of_pages.to_i
end
def output
puts "'#{book}', #{year_of_publishing}, #{number_of_pages} pages"
end
end
#edition1=Edition.new("Pride and Prejudice", 1813, 820)
#edition1.output
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment