When using the triple dot notation in a ruby Range object, I get this:
(0...5).each{|n| p n} 0 1 2 3 4
When I use the \'last\' method I get
As Stefan has answered your observed behavior is expected and documented.
If you want to obtain the last element which would be enumerated by the range without having to enumerate the whole range, you could use Enumerable#reverse_each
irb> (0...5).reverse_each.first => 4