Sha256: badd0da06408f3b4011cfbbd9280e04776bc616c9b688fdc85ca5a064f6ffc86

Contents?: true

Size: 353 Bytes

Versions: 1

Compression:

Stored size: 353 Bytes

Contents

require 'nano/string/first_char'

class String
  # Returns last _n_ characters.
  #
  #   "Hello World".last_char(3)  #=> "rld"
  #
  def last_char(n=1)
    n = n.to_i
    return self if n > size
    slice(-n, n) #self[-n..-1]
  end
end


#  _____         _
# |_   _|__  ___| |_
#   | |/ _ \/ __| __|
#   | |  __/\__ \ |_
#   |_|\___||___/\__|
#
# TODO

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
facets-0.9.0 lib/nano/string/last_char.rb