class SpecsWatcher::Parsers::Availability
Attributes
raw_html[R]
Public Class Methods
new(raw_html)
click to toggle source
# File lib/specs_watcher/parsers/availability.rb, line 11 def initialize(raw_html) @raw_html = raw_html end
parse(raw_html)
click to toggle source
# File lib/specs_watcher/parsers/availability.rb, line 6 def self.parse(raw_html) new(raw_html).parse end
Public Instance Methods
parse()
click to toggle source
# File lib/specs_watcher/parsers/availability.rb, line 15 def parse doc = Nokogiri::HTML(raw_html) rows = doc.css('table')[1].css('tr') { title: doc.css('center').css('font')[0].children[2].text.strip, locations: rows.map { |r| parse_rows(r) } } end
parse_rows(tr)
click to toggle source
# File lib/specs_watcher/parsers/availability.rb, line 24 def parse_rows(tr) { store_name: tr.children[0].text, availability: tr.children[1].text } end