class RockNRoll::Race
Attributes
date[RW]
description[RW]
distances[RW]
hashtag[RW]
location[RW]
url[RW]
Public Class Methods
all()
click to toggle source
# File lib/rock_n_roll/race.rb, line 28 def self.all @@all end
new(location = nil, url = nil)
click to toggle source
# File lib/rock_n_roll/race.rb, line 6 def initialize(location = nil, url = nil) @location = location @url = url @@all << self end
new_from_list(race)
click to toggle source
# File lib/rock_n_roll/race.rb, line 12 def self.new_from_list(race) location = race.css("h3 a").text if location == "" location = "TBD" end url = "https://www.runrocknroll.com" + race.css("h3 a").attribute("href").text if !url.end_with?("/") url += "/" elsif url == "" url = "TBD" end self.new(location, url) end
retrieve(input)
click to toggle source
# File lib/rock_n_roll/race.rb, line 32 def self.retrieve(input) self.all[input.to_i - 1] end
Public Instance Methods
race_site()
click to toggle source
# File lib/rock_n_roll/race.rb, line 36 def race_site @race_site ||= Nokogiri::HTML(open(self.url)) end