Sha256: b966b725110f4844d0a3069393f47af3cf320f359f3b6ee4749505f20f9622b0

Contents?: true

Size: 533 Bytes

Versions: 10

Compression:

Stored size: 533 Bytes

Contents

require 'facets/indexable'
require 'facets/array/splice'

class Array

  include Indexable

  # Alias for shift, which removes and returns
  # the first element in an array.
  #
  #   a = ["a","y","z"]
  #   a.first!      #=> "a"
  #   a             #=> ["y","z"]
  #
  # CREDIT: Trans

  alias_method :first!, :shift

  # Alias for pop, which removes and returns
  # the last element in an array.
  #
  #   a = [1,2,3]
  #   a.last!       #=> 3
  #   a             #=> [1,2]
  #
  # CREDIT: Trans

  alias_method :last!, :pop

end

Version data entries

10 entries across 9 versions & 2 rubygems

Version Path
facets-glimmer-3.2.0 lib/core/facets/array/indexable.rb
facets-3.1.0 lib/core/facets/array/indexable.rb
facets-3.0.0 lib/core/facets/array/indexable.rb
facets-2.9.3 lib/core/facets/array/indexable.rb
facets-2.9.2 lib/core/facets/array/indexable.rb
facets-2.9.2 src/core/facets/array/indexable.rb
facets-2.9.1 lib/core/facets/array/indexable.rb
facets-2.9.0 lib/core/facets/array/indexable.rb
facets-2.9.0.pre.2 lib/core/facets/array/indexable.rb
facets-2.9.0.pre.1 lib/core/facets/array/indexable.rb