Methods

Files

Enumerable

Public Instance Methods

has?(what) click to toggle source

The same as include?() but equality is tested using ===.

[1, 2, "a"].has?(2)       #=> true
[1, 2, "a"].has?(String)  #=> true
[1, 2, "a"].has?(3)       #=> false

NOTE: This is not (presently) a common core extension and is not loaded automatically when using require 'facets'.

TODO: Perhaps matches? would be a better name?

CREDIT: Lavir the Whiolet

# File lib/facets/core-uncommon/facets/enumerable/has.rb, line 15
def has?(what)
  any? { |x| what === x }
end
Also aliased as: have?
have?(what) click to toggle source

Alias for has?

Alias for: has?

[Validate]

Generated with the Darkfish Rdoc Generator 2.