Class: Amzwish::Book

Inherits:
Object
  • Object
show all
Defined in:
lib/amzwish/book.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(title, asin) ⇒ Book

Returns a new instance of Book.



4
5
6
7
# File 'lib/amzwish/book.rb', line 4

def initialize(title, asin)
  @title = title 
  @asin = asin
end

Instance Attribute Details

#asinObject

Returns the value of attribute asin.



3
4
5
# File 'lib/amzwish/book.rb', line 3

def asin
  @asin
end

#titleObject

Returns the value of attribute title.



3
4
5
# File 'lib/amzwish/book.rb', line 3

def title
  @title
end

Instance Method Details

#==(other) ⇒ Object



9
10
11
12
# File 'lib/amzwish/book.rb', line 9

def ==(other)
  other.respond_to?(:asin) && 
    self.asin == other.asin
end

#to_sObject



14
15
16
# File 'lib/amzwish/book.rb', line 14

def to_s
  "#{title}(#{asin})"
end