Issue #6730 has been updated by drbrain (Eric Hodel).

Category set to core
Status changed from Open to Rejected

This is by design, please check the documentation before filing a bug:

$ ri Range#last
Range#last

(from ruby core)
------------------------------------------------------------------------------
  rng.last    -> obj
  rng.last(n) -> an_array
   

------------------------------------------------------------------------------

Returns the last object in the range, or an array of the last n
elements.

Note that with no arguments last will return the object that defines
the end of the range even if #exclude_end? is true.

  (10..20).last      #=> 20
  (10...20).last     #=> 20
  (10..20).last(3)   #=> [18, 19, 20]
  (10...20).last(3)  #=> [17, 18, 19]

----------------------------------------
Bug #6730: last method not really returning last element of range
https://bugs.ruby-lang.org/issues/6730#change-28056

Author: pajamapajama (Bhushan Lodha)
Status: Rejected
Priority: Normal
Assignee: 
Category: core
Target version: 
ruby -v: ruby 1.9.2p320 (2012-04-20 revision 35421) [x86_64-darwin10.8.0]


1.9.2p320 :001 > (0...5).each {|n| p n}
0
1
2
3
4
 => 0...5 
1.9.2p320 :002 > (0...5).last(2)
 => [3, 4] 
1.9.2p320 :003 > (0...5).last
 => 5 
1.9.2p320 :004 > 

The last method on line number 003 should return 4



-- 
http://bugs.ruby-lang.org/