lib/polyfill/v2_3/hash.rb in polyfill-1.0.1 vs lib/polyfill/v2_3/hash.rb in polyfill-1.1.0
- old
+ new
@@ -23,18 +23,19 @@
next_value
end
end
def fetch_values(*keys)
- keys.each_with_object([]) do |key, values|
- value =
- if block_given?
- fetch(key, &::Proc.new)
- else
- fetch(key)
- end
+ if block_given?
+ block = ::Proc.new
- values << value
+ keys.each_with_object([]) do |key, values|
+ values << fetch(key, &block)
+ end
+ else
+ keys.each_with_object([]) do |key, values|
+ values << fetch(key)
+ end
end
end
def to_proc
method(:[]).to_proc