class FiresideFinder::CLI
Attributes
current_gatherings[RW]
geoaddress[RW]
specific_event[RW]
user_input[RW]
Public Class Methods
call()
click to toggle source
# File lib/fireside-finder/cli.rb, line 10 def self.call puts "--------------------------------------------------------------------------------" puts "Welcome to Hearthstone Fireside Gathering Finder Gem!" puts "--------------------------------------------------------------------------------" puts "Use 'new' to get back to this menu, 'exit' will close the program." puts "Please enter your address or zip-code to find local Fireside Gatherings:" user_input = gets.strip while user_input != "exit" FiresideFinder::CLI.print_all(user_input) FiresideFinder::CLI.menu end puts "See you at the Tavern, hero!" end
print_all(user_input)
click to toggle source
# File lib/fireside-finder/cli.rb, line 43 def self.print_all(user_input) FiresideFinder::Scraper::scrape_list(user_input) counter = 0 @current_gatherings = Array.new FiresideFinder::Gathering.all.each do |gather| counter += 1 @current_gatherings << gather puts "--------------------------------------------------------------------------------" puts counter puts "Gathering Name: #{gather.name}" puts "City: #{gather.city}" puts "Date: #{gather.date}" puts "Link to More Info: #{gather.details_link}" puts "--------------------------------------------------------------------------------" end if @current_gatherings.any? puts "" puts "Enter the number above the event you'd like more info about." FiresideFinder::CLI.menu else puts "--------------------------------------------------------------------------------" puts "There are no upcoming events in your area" puts "Please try a new location" puts "" puts "You will be taken back to the main menu in 10 seconds" sleep(10) system "clear" or system "cls" FiresideFinder::CLI.call end end
print_specific(specific_event)
click to toggle source
# File lib/fireside-finder/cli.rb, line 74 def self.print_specific(specific_event) FiresideFinder::Scraper::scrape_specific(specific_event) puts "--------------------------------------------------------------------------------" FiresideFinder::Gathering.all.each do |gather| puts "--------------------------------------------------------------------------------" puts "Gathering Name: #{gather.name}" puts "Venue: #{gather.venue}" puts "Address: #{gather.address}" puts "Date: #{gather.datetime}" if gather.description != nil puts "Event Description: #{gather.description}" end puts "Directions: #{gather.directions}" puts "--------------------------------------------------------------------------------" end puts "--------------------------------------------------------------------------------" puts "Enter 'new' to search a new area, or 'exit' to close the program." FiresideFinder::CLI.menu end