Every time I have to guess from memory whether to use “contain?” or
“include?” within arrays and strings, I always guess wrong (the right
answer is only “include?” BTW).
Since ruby typically allows multiple ways of doing things, consider this
a feature request to add contain? to both String and Array.
Any feedbacks to this idea?
Thanks.
-r
On Sep 23, 4:32 pm, Roger P. [email protected] wrote:
Every time I have to guess from memory whether to use “contain?” or
“include?” within arrays and strings, I always guess wrong (the right
answer is only “include?” BTW).
Since ruby typically allows multiple ways of doing things, consider this
a feature request to add contain? to both String and Array.
Any feedbacks to this idea?
alias :contain?, :include?
That’s what you mean?
On 23 September 2010 22:32, Roger P. [email protected] wrote:
Every time I have to guess from memory whether to use “contain?” or
“include?” within arrays and strings, I always guess wrong (the right
answer is only “include?” BTW).
Since ruby typically allows multiple ways of doing things, consider this
a feature request to add contain? to both String and Array.
Any feedbacks to this idea?
Thanks.
-r
You might want to read the thread about the “in” operator on ruby-core.
Something like:
e.in? ary
e in ary
give more sense to me than any enum.method? e
e in ary
give more sense to me than any enum.method? e
True, though at times I would find it convenient to use the enum method,
like
strin.each_line { |line|
if line.contain? ‘abc’
print ‘yes’
end
}
alias :contain?, :include?
That’s what you mean?
Yep, but just not me having to do it
-r