class Mlb::Game

Attributes

loser[RW]
pitcher_l[RW]
pitcher_w[RW]
save[RW]
score_l[RW]
score_w[RW]
winner[RW]

Public Class Methods

all() click to toggle source
# File lib/mlb/game.rb, line 11
def self.all 
        @@games 
end
find_big_win() click to toggle source
# File lib/mlb/game.rb, line 44
def self.find_big_win
        self.all.sort { |a, b| b.difference <=> a.difference}.first  
end
scrape_standings() click to toggle source
# File lib/mlb/game.rb, line 15
def self.scrape_standings
        puts "\n AL STANDINGS"
        puts "\n TM  W  L  WIN%  GB"
        @@doc.css("#standings-upto-AL-overall tr").each do |row|
              title = row.css("tr:nth-child(1)").text
              team = row.css("th a").text
              wins = row.css("td:nth-child(2)").text.green 
              losses = row.css("td:nth-child(3)").text.red
              win_percentage = row.css("td:nth-child(4)").text.cyan
              games_back = row.css("td:nth-child(5)").text.yellow 
       puts " #{team} #{wins} #{losses} #{win_percentage} #{games_back}"
        end 

        puts "\n NL STANDINGS"
        puts "\n TM  W  L  WIN%  GB"
        @@doc.css("#standings-upto-NL-overall tr").each do |row|
              team = row.css("th a").text
              wins = row.css("td:nth-child(2)").text.green 
              losses = row.css("td:nth-child(3)").text.red
              win_percentage = row.css("td:nth-child(4)").text.cyan
              games_back = row.css("td:nth-child(5)").text.yellow 
              puts " #{team} #{wins} #{losses} #{win_percentage} #{games_back}"
         end 
end

Public Instance Methods

difference() click to toggle source
# File lib/mlb/game.rb, line 40
def difference 
        self.score_w.to_i  - self.score_l.to_i 
end