What's the size of 1.2..3.4?
Regards,
Dan
···
-----Original Message-----
From: Meinrad Recheis [mailto:meinrad.recheis@gmail.com]
Sent: Thursday, April 13, 2006 7:20 AM
To: ruby-talk ML
Subject: Range#sizedear list,
does anyone object to adding the method :size to class Range?
class Range
def size
max-min+1
end
endi think it's useful. maybe others too. i'd like to see it
added to the core. here is the test for Range#size in case
it's really added.def test_range_size
assert_equal 1, (1..1).size
assert_equal 2, (1..2).size
assert_equal 3, (1..3).size
assert_equal 0, (1..1).size
assert_equal 1, (1...2).size
endwhat do you think?
-- henon