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
Generated with the Darkfish Rdoc Generator 2.