Skip to content

Commit

Permalink
Deprecates Object#returning in favor of Object#tap
Browse files Browse the repository at this point in the history
Signed-off-by: José Valim <jose.valim@gmail.com>
  • Loading branch information
spastorino authored and josevalim committed Jul 25, 2010
1 parent a5d8c95 commit 5b0f839
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions activesupport/lib/active_support/core_ext/object/misc.rb
@@ -1,3 +1,5 @@
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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 5b0f839

Please sign in to comment.