lib/polyfill/v2_4/hash/instance/transform_values.rb in polyfill-0.3.0 vs lib/polyfill/v2_4/hash/instance/transform_values.rb in polyfill-0.4.0
- old
+ new
@@ -4,11 +4,11 @@
module Instance
module TransformValues
module Method
def transform_values
unless block_given?
- return Enumerator.new(keys.size) do |yielder|
+ return ::Enumerator.new(keys.size) do |yielder|
each_with_object({}) do |(k, v), acc|
acc[k] = yielder.yield(v)
end
end
end
@@ -17,17 +17,15 @@
acc[k] = yield(v)
end
end
end
- if RUBY_VERSION < '2.4.0'
- refine ::Hash do
- include Method
- end
+ refine ::Hash do
+ include Method
+ end
- def self.included(base)
- base.include Method
- end
+ def self.included(base)
+ base.include Method
end
end
end
end
end