Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Use hash with indifferent access and refactor

  • Loading branch information...
commit af15c5562eed17784bf537622fcb0b17996b8b7b 1 parent 96f549e
@nathanl nathanl authored
Showing with 6 additions and 2 deletions.
  1. +6 −2 lib/dossier/result.rb
View
8 lib/dossier/result.rb
@@ -31,7 +31,11 @@ def arrays
def hashes
return @hashes if defined?(@hashes)
- @hashes = rows.map { |row| Hash[headers.zip(row)] }
+ @hashes = rows.map { |row| row_hash(row) }
+ end
+
+ def row_hash(row)
+ Hash[headers.zip(row)].with_indifferent_access
end
def each
@@ -57,7 +61,7 @@ def format(row)
# Provide the row as context if the formatter takes two arguments
if report.method(method_name).arity == 2
- report.public_send(method_name, field, Hash[headers.zip(row)])
+ report.public_send(method_name, field, row_hash(row))
else
report.public_send(method_name, field)
end
Please sign in to comment.
Something went wrong with that request. Please try again.