Skip to content

Commit

Permalink
adds deprecation warnings to the RDoc of Array#uniq_by(!)
Browse files Browse the repository at this point in the history
  • Loading branch information
fxn committed Dec 20, 2011
1 parent 737960d commit 173eaca
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions activesupport/lib/active_support/core_ext/array/uniq_by.rb
@@ -1,5 +1,7 @@
class Array class Array
# Returns an unique array based on the criteria given as a +Proc+. # *DEPRECATED*: Use +Array#uniq+ instead.
#
# Returns a unique array based on the criteria in the block.
# #
# [1, 2, 3, 4].uniq_by { |i| i.odd? } # => [1, 2] # [1, 2, 3, 4].uniq_by { |i| i.odd? } # => [1, 2]
# #
Expand All @@ -9,7 +11,9 @@ def uniq_by(&block)
uniq(&block) uniq(&block)
end end


# Same as uniq_by, but modifies self. # *DEPRECATED*: Use +Array#uniq!+ instead.
#
# Same as +uniq_by+, but modifies +self+.
def uniq_by!(&block) def uniq_by!(&block)
ActiveSupport::Deprecation.warn "uniq_by! " \ ActiveSupport::Deprecation.warn "uniq_by! " \
"is deprecated. Use Array#uniq! instead", caller "is deprecated. Use Array#uniq! instead", caller
Expand Down

0 comments on commit 173eaca

Please sign in to comment.