Project

General

Profile

ActionsLike0

Bug #8739

closed

Range#last と#last(n)で挙動の統一がされていない

Added by to_ueda (Tomoya Ueda) over 11 years ago. Updated over 11 years ago.

Status:
Closed
Target version:
ruby -v:
ruby 2.1.0dev (2013-08-05) [x86_64-linux]
[ruby-dev:47587]

Description

Range#lastは終端を返しますが、#last(n)は最後の要素を返します。
引数の有無で挙動が異なるのは意図したものでしょうか?
意図したものであれば、返す値を終端か要素どちらかに挙動を統一出来ないでしょうか。

#終端が返る
(1...5).last => 5
#最後の要素が返る
(1...5).last(1) => [4]

#1

Updated by matz (Yukihiro Matsumoto) over 11 years ago

  • Status changed from Open to Rejected
  • Assignee set to matz (Yukihiro Matsumoto)
#2

Updated by matz (Yukihiro Matsumoto) over 11 years ago

  • Status changed from Rejected to Closed
#3

Updated by naruse (Yui NARUSE) over 11 years ago

  • Status changed from Closed to Assigned
  • Assignee changed from matz (Yukihiro Matsumoto) to nobu (Nobuyoshi Nakada)
  • Target version set to 2.1.0
#6

Updated by naruse (Yui NARUSE) over 11 years ago

  • Priority changed from Normal to 5
#9

Updated by nobu (Nobuyoshi Nakada) over 11 years ago

  • Status changed from Assigned to Closed
  • % Done changed from 0 to 100
ActionsLike0

Also available in: Atom PDF