Skip to content

Instantly share code, notes, and snippets.

@aarti
Created November 1, 2013 22:07
Show Gist options
  • Save aarti/7272752 to your computer and use it in GitHub Desktop.
Save aarti/7272752 to your computer and use it in GitHub Desktop.
Mapping Data
def self.parse_detail( rows )
details = rows.map do |row|
detail = {}
[
[:line_item, 0],
[:title, 1],
[:asin, 2],
[:units_sold, 3],
[:units_refunded, 4],
[:net_units_sold, 5],
[:net_units_borrowed, 6],
[:free_units_promo, 7],
[:free_units_price_match, 8],
].each do |dest_name, source_index|
detail[dest_name] = row[source_index]
end
detail
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment