class NYTBestsellers::Book
Attributes
genre[RW]
publisher[RW]
summary[RW]
title[RW]
wol[RW]
Public Class Methods
all()
click to toggle source
# File lib/nytimes/book.rb, line 17 def self.all @@all end
find_by_title(name)
click to toggle source
# File lib/nytimes/book.rb, line 21 def self.find_by_title(name) self.all.find do |book| if name == book.title book end end end
new(hash = {})
click to toggle source
# File lib/nytimes/book.rb, line 6 def initialize(hash = {}) hash.each do |key, value| self.send("#{key}=", value) end @genre = NYTBestsellers::Genre.find_by_name(hash[:genre]) if !wol.empty? || !summary.empty? @genre.books << self @@all << self end end