Unverified Commit ccca5e52 authored by Yukihiro "Matz" Matsumoto's avatar Yukihiro "Matz" Matsumoto Committed by GitHub

Merge pull request #5105 from shuujii/fix-typo-in-Range-last

Fix typo in `Range#last`
parents 212800a9 353ecd71
......@@ -43,7 +43,7 @@ class Range
# (10..20).last(3) #=> [18, 19, 20]
# (10...20).last(3) #=> [17, 18, 19]
def last(*args)
raise RangeError, "cannot get the first element of beginless range" if self.end.nil?
raise RangeError, "cannot get the last element of endless range" if self.end.nil?
return self.end if args.empty?
raise ArgumentError, "wrong number of arguments (given #{args.length}, expected 1)" unless args.length == 1
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment