Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ############# Solved.
- # go throw the rows in the table
- rates_table["body"].each { |row|
- # the first cell in the row is a descriptor for the other cells
- row_description = row.shift["c"]
- # add the rest of the cells in the row, each as their own record
- row.each_with_index { |cell, i|
- unique_id = "#{table_id}-#{cell["cellid"]}"
- record = {
- table_and_cell_id: unique_id,
- table_id: table_id,
- cell_id: cell["cellid"],
- first_column_description: column_descriptions.first,
- row_description: row_description,
- this_column_description: column_descriptions[i+1],
- value: cell["c"]
- }
- @logger.info record[:value]
- if record[:value].include? "as low as"
- @logger.info "Found string: as low as"
- record[:value] = (record[:value].match /[0-9.]+/)[0]
- @logger.info "Transformed value: #{record[:value]}"
- end
- @logger.info "Record: #{record}"
- records.push record
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement