Sha256: b82ea0d14464eb9d49328c5dac9d8230056e382e3c76f7467ecb6db6a42c406a

Contents?: true

Size: 614 Bytes

Versions: 1

Compression:

Stored size: 614 Bytes

Contents

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

    def self.help
      puts "Here are the functions for Stack:"
      puts "show"
      puts "push(value)"
      puts "pop"
      puts "length"
      puts "empty?"
    end

    def self.methods
      self.help
    end

    def help
      Stack.help
    end

    def methods
      help
    end

    def show
      @values
    end

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

    def pop
      @values.pop
    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-0.1.1 lib/zadt/AbstractDataTypes/Stack.rb