Module Stackable
In: lib/core/facets/stackable.rb

Stackable

Stackable mixin provides pop, push, pull, etc. It depends on slice, splice and insert.

Methods

peek   poke   pop   pull   push   shift   unshift  

Public Instance methods

Peek at the top of the stack.

  a = [1, 2, 3]
  a.peek          #=> 3
  a               #=> [1, 2, 3]

Poke item onto the stack.

  a = [2, 3]
  a.poke(1)       #=> [1, 2, 3]

  TODO: Better name (besides unshift)?

Pop item off stack.

  a = [1, 2, 3]
  a.pop           #=> 3
  a               #=> [1, 2]

Pull item off the stack.

  a = [1, 2, 3]
  a.pull          #=> 1
  a               #=> [2, 3]

Push item onto the stack.

  a = [1, 2]
  a.push(3)       #=> [1, 2, 3]
shift()

Alias for pull

unshift(x)

Alias for poke

[Validate]