blob: 60557e574500d8ee8ab0c2bd2eed2470103bab1e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
|
class Book
attr_reader :title, :author, :publisher, :year_published
def initialize(title, author, publisher, year_published)
@title=title
@author=author
@publisher=publisher
@year_published = year_published
end
def is_titled?(title)
@title == title
end
def ==(other)
other.kind_of?( Book ) && @title == other.title && @author == other.author && @publisher == other.publisher && @year_published == other.year_published
end
end
|