Skip to content

Instantly share code, notes, and snippets.

@Fokusnica
Created June 27, 2015 17:09
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/f5d50268e357c1d5bb9c to your computer and use it in GitHub Desktop.
Save Fokusnica/f5d50268e357c1d5bb9c to your computer and use it in GitHub Desktop.
Additional practice Author
class Author
#attr_accessor :name, :year_of_birth, :year_of_death
attr_writer :name, :year_of_birth, :year_of_death
attr_reader :name, :year_of_birth, :year_of_death
def initialize(name = nil, year_of_birth = nil, year_of_death = nil)
@name = name.to_s
@year_of_birth = year_of_birth.to_i
@year_of_death = year_of_death.to_i
end
def output
puts "#{name} #{year_of_birth} - #{year_of_death}"
end
end
#author1=Author.new("Jane Austen", 1775, 1817)
#author1.output
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment