class NYTFiction::CLI

Public Instance Methods

call() click to toggle source
# File lib/nyt_fiction/cli.rb, line 3
def call
  puts "----------------------------"
  puts "This week's New York Times'"
  puts "Print & E-Book Fiction Best Sellers: \n\n"
  NYTFiction::Scraper.scrape_books
  get_books
  list_books
  menu
end
get_books() click to toggle source
# File lib/nyt_fiction/cli.rb, line 13
def get_books
  @books = NYTFiction::Book.all
end
list_books() click to toggle source
# File lib/nyt_fiction/cli.rb, line 17
def list_books
  @books.each.with_index(1) do |b, i|
    puts "#{i}. #{b.title} #{b.author}"
  end
  puts "----------------------------"
end
menu() click to toggle source