class DFSPlayerRankings::Player

Attributes

name[RW]
rank[RW]
totalpoints[RW]

Public Class Methods

all() click to toggle source
# File lib/DFS_player_rankings/player.rb, line 23
def self.all
  @@all
end
find(id) click to toggle source
# File lib/DFS_player_rankings/player.rb, line 27
def self.find(id)
  self.all[id-1]
end
new(name=nil, rank=nil, totalpoints=nil) click to toggle source
# File lib/DFS_player_rankings/player.rb, line 16
def initialize(name=nil, rank=nil, totalpoints=nil)
  @name = name
  @rank = rank
  @totalpoints = totalpoints
  @@all << self
end
new_from_index_page(r) click to toggle source
# File lib/DFS_player_rankings/player.rb, line 8
def self.new_from_index_page(r)
  self.new(
    r.css("td.player a").text,
    r.css("td.rank").text.strip,
    r.css("td.points").text.strip
    )
end

Public Instance Methods

doc() click to toggle source
# File lib/DFS_player_rankings/player.rb, line 31
def doc
  @doc ||= Nokogiri::HTML(open(self.url))
end