in?(another_object) public

Returns true if this object is included in the argument.

When argument is a Range, #cover? is used to properly handle inclusion check within open ranges. Otherwise, argument must be any object which responds to #include?. Usage:

characters = ["Konata", "Kagami", "Tsukasa"]
"Konata".in?(characters) # => true

For non Range arguments, this will throw an ArgumentError if the argument doesn’t respond to #include?.

Show source
Register or log in to add new notes.