Skip to content

Instantly share code, notes, and snippets.

@bil-bas
Forked from andrewhl/parser.rb
Created September 9, 2012 17:00
Show Gist options
  • Save bil-bas/3685673 to your computer and use it in GitHub Desktop.
Save bil-bas/3685673 to your computer and use it in GitHub Desktop.
def parse(page)
table = page.at("table.grid")
rows = table.search("tr").to_a[1..-1]
rows.each.with_object [] do |row, rows|
row = parse_row row.search("td").map(&:text)
rows << row if row
end
end
def parse_row(row)
if row[4] == "Demonstration"
nil
else
Row.new(*row)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment