提交 5b0f8390 编写于 作者: S Santiago Pastorino 提交者: José Valim

Deprecates Object#returning in favor of Object#tap

Signed-off-by: NJosé Valim <jose.valim@gmail.com>
上级 a5d8c95a
require 'active_support/deprecation'
class Object
# Returns +value+ after yielding +value+ to the block. This simplifies the
# process of constructing an object, performing work on the object, and then
......@@ -36,6 +38,7 @@ class Object
#
# foo # => ['bar', 'baz']
def returning(value)
ActiveSupport::Deprecation.warn('Object#returning has been deprecated in favor of Object#tap.', caller)
yield(value)
value
end
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册