Class: Object

Inherits:
BasicObject
Defined in:
lib/object-in.rb

Instance Method Summary collapse

Instance Method Details

#in?(array) ⇒ Boolean

Returns:

  • (Boolean)


4
5
6
7
8
9
10
11
12
# File 'lib/object-in.rb', line 4

def in?(array)

  unless array.is_a? Array
    raise TypeError, "Object#in? can only accept an array parameter"
  end

  array.include? self

end