class HofStats::CLI
Public Instance Methods
call()
click to toggle source
# File lib/hof_stats/cli.rb, line 3 def call list_players menu goodbye end
goodbye()
click to toggle source
# File lib/hof_stats/cli.rb, line 73 def goodbye puts "Goodbye!" end
list_individual_player(player)
click to toggle source
# File lib/hof_stats/cli.rb, line 24 def list_individual_player(player) puts "Player Name: #{player.name}" if player.position == "" || player.position == "Manager" puts "No stats available for #{player.name}." else puts "Position: #{player.position}" if player.position.include? "Pitcher" puts "ERA: #{player.era}" puts "W/L %: #{player.wlpercent}" puts "Strikeouts: #{player.strikeouts}" else puts "Games: #{player.games}" puts "Hits: #{player.hits}" puts "Runs: #{player.runs}" puts "Homers: #{player.homers}" puts "Batting Average: #{player.batting_avg}" end end end
list_players()
click to toggle source
# File lib/hof_stats/cli.rb, line 9 def list_players HofStats::Scraper.new.make_player puts "MLB Hall of Famers" @players = HofStats::Player.all @players.each_with_index do |player, i| if player.votes == "" player.votes = "N/A" end if player.percent == "" player.percent = "N/A %" end puts "#{i+1}. #{player.name} - #{player.year} - #{player.votes} votes - #{player.percent}" end end