blob: f30333fd02fb0c4c2d4b4f342970784c095baa82 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
|
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)
raise ArgumentError.new("You must supply another object that responds to include?") unless another_object.respond_to?(:include?)
another_object.include?(self)
end
end
|