class String
def last(limit = 1)
Experimental RBS support (using type sampling data from the type_fusion
project).
def last: (?Integer limit) -> untyped
This signature was generated using 1 sample from 1 application.
str.last(0) # => ""
str.last(2) # => "lo"
str.last(1) # => "o"
str.last # => "o"
str = "hello"
the given limit is greater than or equal to the string length, returns a copy of self.
from the end of the string until it reaches the limit value (counting backwards). If
Returns the last character of the string. If a limit is supplied, returns a substring
def last(limit = 1) self[[length - limit, 0].max, limit] || raise(ArgumentError, "negative limit") end