Sha256: 591846ada35187a07a361a9addbe4eacb70e9cb2ffe8669041acda1450510a02

Contents?: true

Size: 360 Bytes

Versions: 1

Compression:

Stored size: 360 Bytes

Contents

module Zadt
  class Stack
    def initialize
      @values = Array.new
    end

    def show
      @values
    end

    def push(val)
      @values.push(val)
      @values
    end

    def pop
      @values.pop
    end

    def peek
      @values.last
    end

    def length
      @values.length
    end

    def empty?
      @values.empty?
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
zadt-1.1.7 lib/zadt/AbstractDataTypes/StackQueue/Stack.rb