提交 c51a9b97 编写于 作者: Y yui-knk

Ensure `#transform_values` of HWIDA to return HWIDA

On Ruby 2.4, naitive `Hash#transform_values` is implemented.
`Hash#transform_values` uses an instance of Hash (`rb_hash_new`) to
collect returned values of a block.
For ensuring `#transform_values` of HWIDA to return HWIDA, we should
define `#transform_values` on HWIDA.
上级 c0e656fe
......@@ -273,6 +273,11 @@ def reject(*args, &block)
dup.tap { |hash| hash.reject!(*args, &block) }
end
def transform_values(*args, &block)
return to_enum(:transform_values) unless block_given?
dup.tap { |hash| hash.transform_values!(*args, &block) }
end
# Convert to a regular hash with string keys.
def to_hash
_new_hash = Hash.new
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册