class AmazonBook::Book
Attributes
availability[RW]
name[RW]
price[RW]
publisher[RW]
review[RW]
url[RW]
Public Class Methods
all()
click to toggle source
# File lib/AmazonBook/book.rb, line 26 def self.all @@all end
create_from_list(book_array)
click to toggle source
# File lib/AmazonBook/book.rb, line 12 def self.create_from_list(book_array) book_array.each do |book| self.new(book[:name],book[:url]) end end
new(name, url)
click to toggle source
# File lib/AmazonBook/book.rb, line 6 def initialize(name, url) @name = name @url = url @@all << self end
Public Instance Methods
add_attributes(book_hash)
click to toggle source
# File lib/AmazonBook/book.rb, line 18 def add_attributes(book_hash) @review = book_hash[:review] @author = book_hash[:author] @price = book_hash[:price] @availability = book_hash[:availability] @publisher = book_hash[:publisher] end