Created
January 21, 2013 22:57
-
-
Save hashrocketeer/4590301 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module TabularSupport | |
def hashes_from_table | |
actual = find("table") | |
headers = actual.all("th").map(&:text) | |
actual.all("tbody tr").map do |row| | |
Hash[headers.zip row.all("td").map(&:text).compact.map(&:strip)] | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment