method

last

v3.2.8 - Show latest stable - Class: String
last(limit = 1)
public

Returns the last character of the string or the last limit characters.

Examples:

"hello".last     # => "o"
"hello".last(2)  # => "lo"
"hello".last(10) # => "hello"