instance method
in?
Ruby on Rails 3.1.12
Since v3.1.12Signature
in?(another_object)
Returns true if this object is included in the argument. Argument must be any object which responds to #include?. Usage:
characters = ["Konata", "Kagami", "Tsukasa"] "Konata".in?(characters) # => true
This will throw an ArgumentError if the argument doesn’t respond to #include?.
Parameters
-
another_objectreq
Source
# File activesupport/lib/active_support/core_ext/object/inclusion.rb, line 10
def in?(another_object)
another_object.include?(self)
rescue NoMethodError
raise ArgumentError.new("The parameter passed to #in? must respond to #include?")
end
Defined in activesupport/lib/active_support/core_ext/object/inclusion.rb line 10
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in Object