Sha256: a818d953907a081efb241604297f39abac0e855386bbfb65e7030c670dd9c2b6

Contents?: true

Size: 454 Bytes

Versions: 1

Compression:

Stored size: 454 Bytes

Contents

require 'nano/array/bulk'

class Array

  # Like #last, returning the last element
  # in an array.
  #
  #   [1,2,3].foot  #=> [3]
  #
  def foot
    slice(-1,1)
  end

end


#  _____         _
# |_   _|__  ___| |_
#   | |/ _ \/ __| __|
#   | |  __/\__ \ |_
#   |_|\___||___/\__|
#
=begin test

  require 'test/unit'

  class TCArray < Test::Unit::TestCase

    def test_foot
      a = [1,2,3,4,5]
      assert_equal( [5], a.foot )
    end

  end

=end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
facets-0.9.0 lib/nano/array/foot.rb