module BestSellingBooks::Collectable

Public Instance Methods

create_and_collect_books() click to toggle source
# File lib/best_selling_books/collectable.rb, line 5
def create_and_collect_books
  self::Scraper.scrape_book_list.each do |hash|
    instance = BestSellingBooks::Books.new
    instance.title = hash[:Title]
    instance.author = hash[:Author]
    instance.author_bio = hash[:Author_Bio]
    instance.price = hash[:Price]
    instance.format = hash[:Format]
    instance.rating = hash[:Rating]
    instance.link = hash[:Link]
    instance.rank = hash[:Rank]
    self.all_books << instance
  end
end
list_best_sellers() click to toggle source
# File lib/best_selling_books/collectable.rb, line 20
def list_best_sellers
  puts self.name + "'s Top 20"
  self.all_books.each {|instance| puts "#{instance.rank}. #{instance.title} by #{instance.author}"}
end