Skip to content

Commit

Permalink
Remove conversion no longer needed
Browse files Browse the repository at this point in the history
  • Loading branch information
deivid-rodriguez committed Jan 17, 2020
1 parent 0234c60 commit 0c33f1a
Showing 1 changed file with 1 addition and 14 deletions.
15 changes: 1 addition & 14 deletions lib/simplecov/result.rb
Original file line number Diff line number Diff line change
Expand Up @@ -69,27 +69,14 @@ def self.from_hash(hash)
command_name, data = hash.first

result = SimpleCov::Result.new(
symbolize_names_of_coverage_results(data[:coverage])
data[:coverage]
)

result.command_name = command_name.to_s
result.created_at = Time.at(data[:timestamp])
result
end

# Manage symbolize the keys of coverage hash.
# JSON.parse gives coverage hash with stringified keys what breaks some logics
# inside the process that expects them as symboles.
#
# @return [Hash]
def self.symbolize_names_of_coverage_results(coverage_data)
coverage_data.each_with_object({}) do |(file_name, file_coverage_result), coverage_results|
coverage_results[file_name] = file_coverage_result.each_with_object({}) do |(k, v), cov_elem|
cov_elem[k.to_sym] = v
end
end
end

private

def coverage
Expand Down

0 comments on commit 0c33f1a

Please sign in to comment.