Skip to content

Commit

Permalink
Rewrite logic using each_with_object with
Browse files Browse the repository at this point in the history
  • Loading branch information
Kouta Imanaka committed Aug 15, 2018
1 parent 678191e commit 3ad03e5
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions lib/apkstats/command/apk_analyzer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -71,12 +71,10 @@ def self.to_feature(str)
end

def self.parse_reference_to_map(command_output)
reference_map = {}
command_output.split(/\r?\n/).map do |s|
dex_file, method_count = s.strip.split(/\t/)
reference_map[dex_file] = method_count
command_output.split(/\r?\n/).each_with_object({}) do |s, acc|
dex_file, method_count = s.strip.split(/\t/, 2)
acc[dex_file] = method_count
end
reference_map
end

private
Expand Down

0 comments on commit 3ad03e5

Please sign in to comment.