Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Improve `fetch_values` implementation

Co-authored-by: Rodrigo Serradura <[email protected]>
  • Loading branch information
tomascco and serradura committed Aug 27, 2021
1 parent e6e49fd commit b70db07
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions lib/micro/case/utils.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,9 @@ def slice(hash, keys)
def fetch_values(hash, keys, &block)
return hash.fetch_values(*keys, &block) if respond_to?(hash, :fetch_values)

result = []

keys.each do |key|
result << hash.fetch(key, &block)
keys.each_with_object([]) do |key, values|
values << hash.fetch(key, &block)
end

result
end
end

Expand Down

0 comments on commit b70db07

Please sign in to comment.