class BookwormBuddy::Book

Constants

ALL

Attributes

author[RW]
description[RW]
description_url[RW]
price[RW]
title[RW]

Public Class Methods

create(book_array) click to toggle source
# File lib/bookworm_buddy/book.rb, line 10
def self.create(book_array)
    book_array.each {|book| self.new(book)}
end
empty() click to toggle source
# File lib/bookworm_buddy/book.rb, line 27
def self.empty
    ALL.clear
end
list_books_by_category(category_number) click to toggle source
# File lib/bookworm_buddy/book.rb, line 14
def self.list_books_by_category(category_number)
    puts BookwormBuddy::Category::ALL[category_number.to_i - 1].name.colorize(:magenta)
    ALL.each_with_index {|book, index| puts "#{index+1}. \"#{book.title}\" - by: #{book.author} - #{book.price}"}
end
list_description(description) click to toggle source
# File lib/bookworm_buddy/book.rb, line 23
def self.list_description(description)
    puts "#{description}"
end
list_title(book) click to toggle source
# File lib/bookworm_buddy/book.rb, line 19
def self.list_title(book)
    puts "'#{book.title}'".colorize(:magenta)
end
new(bestseller_hash) click to toggle source
# File lib/bookworm_buddy/book.rb, line 5
def initialize(bestseller_hash)
    bestseller_hash.each {|key, value| self.send("#{key}=", value)}
    ALL << self 
end