class AtpRankings::Athlete
Attributes
age[RW]
birthplace[RW]
coach[RW]
current_atp_rank[RW]
name[RW]
orientation[RW]
overall_prize_money_earned[RW]
overall_record[RW]
overall_titles[RW]
points[RW]
rank[RW]
tourn_played[RW]
turned_pro[RW]
url[RW]
Public Class Methods
all()
click to toggle source
# File lib/atp_rankings/athlete.rb, line 16 def self.all @@all end
find(id)
click to toggle source
# File lib/atp_rankings/athlete.rb, line 20 def self.find(id) self.all[id-1] end
find_by_name(name)
click to toggle source
# File lib/atp_rankings/athlete.rb, line 25 def self.find_by_name(name) self.all.detect do |athlete| athlete.name.downcase.strip == name.downcase.strip || athlete.name.split(" ").first.strip.downcase == name.downcase.strip end end
new(rank=nil, name=nil, age=nil, points=nil, tourn_played=nil, url=nil)
click to toggle source
# File lib/atp_rankings/athlete.rb, line 6 def initialize(rank=nil, name=nil, age=nil, points=nil, tourn_played=nil, url=nil) @rank = rank @name = name @age = age @points = points @tourn_played = tourn_played @url = url @@all << self end
Public Instance Methods
doc()
click to toggle source
# File lib/atp_rankings/athlete.rb, line 108 def doc @doc ||= Nokogiri::HTML(open(self.url)) end