aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support/core_ext/object/inclusion.rb
blob: cc7edc0f176492148f139fc2bbe8fd08455ea4bd (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
class Object
  # Returns true if this object is included in the argument. Argument must be
  # any object which respond to +#include?+. Usage:
  #
  #   characters = ["Konata", "Kagami", "Tsukasa"]
  #   "Konata".in?(characters) # => true
  #
  def in?(another_object)
    another_object.include?(self)
  end
end