class MlsStandings::CLI
Public Instance Methods
call()
click to toggle source
# File lib/mls_standings/cli.rb, line 3 def call MlsStandings::Scrapper.create_teams start_menu end
east_team_record(input)
click to toggle source
# File lib/mls_standings/cli.rb, line 92 def east_team_record(input) system "clear" team = MlsStandings::Team.eastern_conf[input - 1] puts "#{team.name}".colorize(:blue) puts "***********************".colorize(:blue) puts "Games Played: #{team.games_played}" puts "Wins: #{team.wins}" puts "Losses: #{team.losses}" puts "Ties: #{team.ties}" puts "\n Type 'MLS' to restart CLI or 'e' to exit:" until input == 'e' || input == 'mls' input = gets.strip.downcase case input.downcase when "e" exit when "mls" start_menu else puts "Not Valid. Please select type 'MLS' or 'e': " end end end
eastern_conf()
click to toggle source
# File lib/mls_standings/cli.rb, line 36 def eastern_conf system "clear" puts " MLS Eastern Conference".colorize(:blue) puts " **********************".colorize(:blue) i = 1 teams= MlsStandings::Team.eastern_conf teams.each do |team| puts "#{i}. #{team.name}" i += 1 end puts "\nSelect 1-11 to get more information on the team, 's' to switch conference, or exit:" input = nil until input == 'et' || input == 's' || input.to_i.between?(1, 11) input = gets.strip.downcase case when input.to_i.between?(1, 11) east_team_record(input.to_i) when input.downcase == "s" western_conf when input.downcase == "e" exit else puts "Not a valid team. Please select a valid team or, 's' to switch or 'e' to exit: " end end end
west_team_record(input)
click to toggle source
# File lib/mls_standings/cli.rb, line 116 def west_team_record(input) system "clear" team = MlsStandings::Team.western_conf[input - 1] puts "#{team.name}".colorize(:red) puts "***********************".colorize(:red) puts "Games Played: #{team.games_played}" puts "Wins: #{team.wins}" puts "Losses: #{team.losses}" puts "Ties: #{team.ties}" puts "\n Type 'MLS' to restart CLI or 'e' to exit:" until input == 'e' || input == 'mls' input = gets.strip.downcase case input.downcase when "e" exit when "mls" start_menu else puts "Not Valid. Please select type 'MLS' or 'exit': " end end end
western_conf()
click to toggle source
# File lib/mls_standings/cli.rb, line 64 def western_conf system "clear" puts " MLS Western Conference".colorize(:red) puts " **********************".colorize(:red) i = 1 teams = MlsStandings::Team.western_conf teams.each do |team| puts "#{i}. #{team.name}" i += 1 end puts "\nSelect 1-11 to get more information on the team, 's' to switch conference, or exit:" input = nil until input == 'e' || input == 's'||input.to_i.between?(1, 12) input = gets.strip.downcase case when input.to_i.between?(1, 12) west_team_record(input.to_i) when input.downcase == "s" eastern_conf when input.downcase == "e" exit else puts "Not a valid team. Please select a valid team or, 's' or 'e': " end end end