Justin Collins
1/13/2006 8:59:00 PM
It happens in 1.8.2 for me. It shows "1" and "10" as being in the range,
but nothing else.
[justinc@justinc-dsktp ~]$ ruby -v
ruby 1.8.2 (2004-12-25) [i586-linux-gnu]
[justinc@justinc-dsktp ~]$ irb
irb(main):001:0> range = ("1".."10")
=> "1".."10"
irb(main):002:0> range.to_a
=> ["1", "2", "3", "4", "5", "6", "7", "8", "9", "10"]
irb(main):003:0> range.member?("1")
=> true
irb(main):004:0> range.member?("2")
=> false
irb(main):005:0> range.member?("10")
=> true
irb(main):006:0>
Note that range _isn't_ getting converted into an array.
-Justin
Daniel Berger wrote:
> James Edward Gray II wrote:
>> I'm not understanding what I am seeing here. Can anyone please
>> explain why the last line of this session gives *false* as an answer?
>>
>> >> range = ("1".."10")
>> => "1".."10"
>> >> range.to_a
>> => ["1", "2", "3", "4", "5", "6", "7", "8", "9", "10"]
>> >> range.member?("1")
>> => true
>> >> range.member?("2")
>> => false
>>
>> James Edward Gray II
>
> I cannot duplicate this with 1.8.2 or 1.8.4.
>
> - Dan
>
>
>