class NBA::CLI
Public Instance Methods
games()
click to toggle source
# File lib/nba/cli.rb, line 7 def games if options[:date].nil? || options[:date] == 'today' game_date_in_et = (Time.now.utc - 5 * 60 * 60).strftime("%Y%m%d") elsif options[:date] == 'yesterday' game_date_in_et = (Time.now.utc - (5 + 24) * 60 * 60).strftime("%Y%m%d") else game_date_in_et = options[:date] end Game.all(game_date_in_et) end
teams()
click to toggle source
# File lib/nba/cli.rb, line 22 def teams team_results = Team.all.select { |team| team.name =~ %r|#{options[:name]}|i } if team_results.count == 0 puts "No team founded with name #{options[:name]}" else team_results.each do |team| team.pretty_print puts "-" * 42 end end end