R
Ray Bovet
[Note: parts of this message were removed to make it a legal post.]
Since I haven't posted to this group in the past 5 years or so, let me
start by saying how much I enjoy using Ruby! My comments below reflect
my desire to see a couple of small issues improved in this extraordinary
language!
The first is a requested feature (which works in 1.8.7 but not in
1.9.2p136), while the second appears to me to be a bug that exists in
both 1.8.7 and 1.9.2:
1. Range.step says (per PickAxe 3) that it works with range elements
that support .succ, or with numbers. It would be nice to have it work
with elements that support .succ, /or with elements that support adding
a number to them/. This would allow stepping through time ranges, for
example.
2. Range.step where the end is specified to be excluded ( '...') on
floats seems to exclude the last value that should be included. For
example:
( 1.0 ... 5.01).step( 2) {|x| puts x}
outputs 1.0 and 3.0 but not 5.0.
Interestingly, ( 1.0 ... 5.01).cover?( 5.0) returns true, as it should!
*Ray Bovet*
**
Since I haven't posted to this group in the past 5 years or so, let me
start by saying how much I enjoy using Ruby! My comments below reflect
my desire to see a couple of small issues improved in this extraordinary
language!
The first is a requested feature (which works in 1.8.7 but not in
1.9.2p136), while the second appears to me to be a bug that exists in
both 1.8.7 and 1.9.2:
1. Range.step says (per PickAxe 3) that it works with range elements
that support .succ, or with numbers. It would be nice to have it work
with elements that support .succ, /or with elements that support adding
a number to them/. This would allow stepping through time ranges, for
example.
2. Range.step where the end is specified to be excluded ( '...') on
floats seems to exclude the last value that should be included. For
example:
( 1.0 ... 5.01).step( 2) {|x| puts x}
outputs 1.0 and 3.0 but not 5.0.
Interestingly, ( 1.0 ... 5.01).cover?( 5.0) returns true, as it should!
*Ray Bovet*
**