提交 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 class Object
# Returns +value+ after yielding +value+ to the block. This simplifies the # Returns +value+ after yielding +value+ to the block. This simplifies the
# process of constructing an object, performing work on the object, and then # process of constructing an object, performing work on the object, and then
...@@ -36,6 +38,7 @@ class Object ...@@ -36,6 +38,7 @@ class Object
# #
# foo # => ['bar', 'baz'] # foo # => ['bar', 'baz']
def returning(value) def returning(value)
ActiveSupport::Deprecation.warn('Object#returning has been deprecated in favor of Object#tap.', caller)
yield(value) yield(value)
value value
end end
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册