Sha256: 0a7481d3eb7b5d15df4dec20a1262194b20ab78f783918f315386481f4124264
Contents?: true
Size: 441 Bytes
Versions: 7
Compression:
Stored size: 441 Bytes
Contents
# TITLE: # Stackable # # DESCRIPTION: # Stackable mixin. # Stackable mixin provides #pop, #push, #pull, etc. # It depends on #slice, #splice and #insert. module Stackable # def pop splice(-1) end # def push(x) insert(-1,x) end # def pull slice(0) end alias_method :shift, :pull # def poke(x) insert(0,x) end alias_method :unshift, :poke # def peek splice(-1) end end
Version data entries
7 entries across 7 versions & 1 rubygems