Class: BggHotnessCLI::CLI

Inherits:
Object
  • Object
show all
Defined in:
lib/bgg-hotness-cli/cli.rb

Class Method Summary collapse

Class Method Details

.goodbyeObject

Displays goodbye and ends program



3
4
5
6
7
8
# File 'lib/bgg-hotness-cli/cli.rb', line 3

def self.goodbye
  puts
  puts "Goodbye!"
  puts
  return
end

.headerObject



10
11
12
13
14
# File 'lib/bgg-hotness-cli/cli.rb', line 10

def self.header
  puts "\e[H\e[2J"
  puts 
  puts "BGG Hotness CLI"
end

.runObject

Runs program by creating empty pages, doing a scrape of the hot list, adding games to pages, and printing the first 10 items on the list.



19
20
21
22
23
24
25
26
27
28
# File 'lib/bgg-hotness-cli/cli.rb', line 19

def self.run
  # Create empty pages
  BggHotnessCLI::Page.make_pages

  # Scrape list, which creates game instances
  # and adds them to their pages in order.
  BggHotnessCLI::Scraper.new("https://www.boardgamegeek.com/xmlapi2/hot?boardgame").game_list
  
  BggHotnessCLI::Page.all[0].display_page
end