blob: 79e9fd6c8868558f5ef394b04025be650b6702d6 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
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
# Returns true if this object is included in the argument list. Usage:
#
# username = "sikachu"
# username.either?("josevalim", "dhh", "wycats") # => false
#
def either?(*objects)
objects.include?(self)
end
end
|