Sha256: b98eea4b89b30e9cdab33639d3f30a214b2fab0d8a6dc78474a5a6f93e59776a

Contents?: true

Size: 588 Bytes

Versions: 10

Compression:

Stored size: 588 Bytes

Contents

require 'facets/array/splice'
require 'facets/stackable'

class Array

  include Stackable

  # "Put On Top". This is an alias for unshift
  # which puts an object# on top of the stack.
  # It is the converse of push.
  #
  #   a=[1,2,3]
  #   a.poke(9)   #=> [9,1,2,3]
  #   a           #=> [9,1,2,3]
  #
  # CREDIT: Trans

  alias_method :poke, :unshift

  # Alias for shift which removes an object
  # off first slot of an array. This is
  # the contrary of pop.
  #
  #   a=[1,2,3]
  #   a.pull  #=> 1
  #   a       #=> [2,3]
  #
  # CREDIT: Trans

  alias_method :pull, :shift

end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
facets-2.8.4 lib/core/facets/array/stackable.rb
facets-2.8.3 lib/core/facets/array/stackable.rb
facets-2.8.2 lib/core/facets/array/stackable.rb
facets-2.8.1 lib/core/facets/array/stackable.rb
facets-2.8.0 lib/core/facets/array/stackable.rb
facets-2.7.0 lib/core/facets/array/stackable.rb
facets-2.6.0 lib/core/facets/array/stackable.rb
facets-2.5.1 lib/core/facets/array/stackable.rb
facets-2.5.0 lib/core/facets/array/stackable.rb
facets-2.5.2 lib/core/facets/array/stackable.rb