class ShootingMatchFinder::CLI
Constants
- BASE_PATH
Public Instance Methods
add_attributes_to_match()
click to toggle source
# File lib/shooting_match_finder/cli.rb, line 18 def add_attributes_to_match #Adds details to those newly created matches. Match.show_matches.each do |match| attributes = ShootingMatchFinder::Scraper.scrape_from_match_url(BASE_PATH + match.match_url) match.add_attributes(attributes) end end
create_matches()
click to toggle source
# File lib/shooting_match_finder/cli.rb, line 13 def create_matches #Scrapes and then passes an array of hashes to Match.rb matches = ShootingMatchFinder::Scraper.scrape_matches(BASE_PATH + '/search/matches') Match.new_from_practiscore(matches) end
farewell()
click to toggle source
# File lib/shooting_match_finder/cli.rb, line 51 def farewell #Says goodbye! puts "Come back again for more matches!" end
list_matches()
click to toggle source
# File lib/shooting_match_finder/cli.rb, line 25 def list_matches #Lists out the created matches by iterating over Match @@all. puts "Here are the matches in your area:" Match.show_matches.each.with_index(1){|match, i| puts "#{i}. #{match.name}"} end
start()
click to toggle source
# File lib/shooting_match_finder/cli.rb, line 5 def start create_matches add_attributes_to_match list_matches menu farewell end