Project

General

Profile

Actions

Feature #4086

closed

Feature request: add String#contain? and {Enumerable,Array}#contain? methods

Added by rogerdpack (Roger Pack) over 13 years ago. Updated almost 12 years ago.

Status:
Rejected
Target version:
-
[ruby-core:33335]

Description

=begin
Hello all.

I debated this suggestion previously on ruby talk ( http://www.ruby-forum.com/topic/217473 ) and nobody seemed to have negative feedback, so here goes...

Currently Strings and Enumerables have a contain? method for searching for if one includes another.

I tend to "reach for" an include? method for the same, since it makes more sense in my head. For instance "is this string included in that one? Does this array include this member?"

Since ruby is typically not averse to several ways to do the same thing (example: Array#{detect,find}, Array#{collect,map} etc.) I propose that
new methods be added of String#contain? and {Enumerable,Array}#contain?

I'd be happy to code up a patch if it had a chance of being accepted.
Feedback welcome.
Cheers!
-roger
=end


Files

add_contain_method.diff (3.12 KB) add_contain_method.diff rogerdpack (Roger Pack), 06/02/2011 03:55 AM
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0Like0Like0