Range methods include? and member?


#1

Do the Range methods include? and member? now do the same thing?
I thought include? returned true if the given value was within the
range bounds and member? returned true if the given value would be
encountered when iterating through the range.

For example,

r = 1…10
r.include?(5.5) # results in true
r.member?(5.5) # results in false

The print version of Pickaxe second edition has this example on page
599. It shows these methods returning different values, but the latest
PDF version shows them returning the same thing. I tried this example
in irb using Ruby 1.8.4 and they now seem to return the same values.


#2

On Jun 6, 2006, at 9:48 AM, Mark V. wrote:

Do the Range methods include? and member? now do the same thing?

Yes, they do. I ran into this issue a while back and had to come
here to get it confirmed too. :wink:

James Edward G. II