lib/invoca/utils/hash.rb in invoca-utils-0.3.0 vs lib/invoca/utils/hash.rb in invoca-utils-0.4.0
- old
+ new
@@ -1,9 +1,8 @@
# frozen_string_literal: true
# Invoca ::Hash extensions
class Hash
-
def select_hash(&block)
res = {}
each { |k, v| res[k] = v if (block.arity == 1 ? yield(v) : yield(k, v)) } # rubocop:disable Style/ParenthesesAroundCondition
res
end