class Player

Public Instance Methods

h2h(opponent) click to toggle source
# File lib/atpruby/player.rb, line 17
def h2h opponent
  return if opponent.nil?
  w = wins.where(loser_id:opponent.player_id).count
  l = losses.where(winner_id:opponent.player_id).count
  "#{w}-#{l}"
end
h2h_details(opponent) click to toggle source
# File lib/atpruby/player.rb, line 24
def h2h_details opponent
  return if opponent.nil?
  w = wins.where(loser_id:opponent.player_id)
  l = losses.where(winner_id:opponent.player_id)
  w.union(l)
end
matches() click to toggle source
# File lib/atpruby/player.rb, line 13
def matches
  wins.union(losses)
end
name() click to toggle source
# File lib/atpruby/player.rb, line 9
def name
  [self.firstname, self.lastname].join(' ')
end
slam_finals() click to toggle source
# File lib/atpruby/player.rb, line 35
def slam_finals
  w = wins.where(tourney_level:'G',round:'F')
  l = losses.where(tourney_level:'G',round:'F')
  w.union(l)
end
slams() click to toggle source
# File lib/atpruby/player.rb, line 31
def slams
  wins.where(tourney_level:'G',round:'F')
end