Class: Scraper

Inherits:
Object
  • Object
show all
Defined in:
lib/snowbowl/scraper.rb

Constant Summary collapse

@@all =
[]

Class Method Summary collapse

Class Method Details

.allObject



18
19
20
# File 'lib/snowbowl/scraper.rb', line 18

def self.all
  @@all
end

.scrape_page(link) ⇒ Object



8
9
10
11
12
13
14
15
16
# File 'lib/snowbowl/scraper.rb', line 8

def self.scrape_page(link)
  report = Nokogiri::HTML(open(link))
  date = report.css("tr")[1].children.children[4].text
  base = report.css("tr")[3].children[5].text.split("\n        ").last.to_i
  top = report.css("tr")[4].children[5].text.split("\n        ").last.to_i

  @@all << {date: date, top: top, base: base}

end