Created
October 15, 2010 19:50
-
-
Save pragdave/628826 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
# Ask Nokogiri to find the row containing the header names | |
headers = table.search('thead > tr') | |
# Create a hash that maps the column name to the column index, so I can access subsequent | |
# rows' data by name | |
header_map = headers.search('th') | |
.map(&:text) | |
.each_with_index | |
.with_object({}) {|(name, index), hash| hash[name] = index} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment