blob: cf89288aede25314b225a8af6290c224b7d896ab (
plain) (
tree)
|
|
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.among?("josevalim", "dhh", "wycats") # => false
#
def among?(*objects)
objects.include?(self)
end
end
|