From: "Berger, Daniel" Date: 2006-04-13T23:34:30+09:00 Subject: Re: Range#size > -----Original Message----- > From: Meinrad Recheis [mailto:meinrad.recheis@gmail.com] > Sent: Thursday, April 13, 2006 7:20 AM > To: ruby-talk ML > Subject: Range#size > > > dear list, > > does anyone object to adding the method :size to class Range? > > class Range > def size > max-min+1 > end > end > > i 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 > end > > what do you think? > -- henon What's the size of 1.2..3.4? Regards, Dan