Method: String#last
- Defined in:
-
lib/mail/core_extensions/string/access.rb,
lib/mail/core_extensions/string/access.rb
Returns the last character of the string or the last limit characters.
Examples:
"hello".last # => "o"
"hello".last(2) # => "lo"
"hello".last(10) # => "hello"
62 63 64 65 66 67 68 69 70 |
# File 'lib/mail/core_extensions/string/access.rb', line 62 def last(limit = 1) if limit == 0 '' elsif limit >= size self else mb_chars[(-limit)..-1].to_s end end |