class DjiScraper
Public Instance Methods
scrape()
click to toggle source
# File lib/stock_index/scrapers/dji_scraper.rb, line 3 def scrape doc = Nokogiri::HTML(open(StockIndex::INDICES['^DJI'][:url])) parse_rows doc.css('table.wikitable.sortable tr') end
Private Instance Methods
market(tr)
click to toggle source
# File lib/stock_index/scrapers/dji_scraper.rb, line 15 def market(tr) market_td = td(tr, 1) market = market_td ? market_td.css('a').first.text : nil StockIndex::Market.new(market).to_iso10383 end
symbol(tr)
click to toggle source
# File lib/stock_index/scrapers/dji_scraper.rb, line 10 def symbol(tr) symbol_td = td(tr, 2) symbol_td ? symbol_td.css('a').first.text : nil end
wikipedia_link(tr)
click to toggle source
# File lib/stock_index/scrapers/dji_scraper.rb, line 21 def wikipedia_link(tr) wikipedia_position(tr, 0) end