Sha256: a33970884120979414dbac70085f80aa6512392c83e41c51d1e36ddee951aba0

Contents?: true

Size: 635 Bytes

Versions: 7

Compression:

Stored size: 635 Bytes

Contents

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

    def self.help
      puts "Here are the functions for Queue:"
      puts "#show"
      puts "#enqueue(value)"
      puts "#dequeue"
      puts "#length"
      puts "#empty?"
    end

    def self.methods
      self.help
    end

    def help
      Queue.help
    end

    def methods
      help
    end

    def show
      @values
    end

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

    def dequeue
      @values.shift
    end

    def length
      @values.length
    end

    def empty?
      @values.empty?
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
zadt-0.1.8 lib/zadt/AbstractDataTypes/MinMaxStackQueue/Queue.rb
zadt-0.1.7 lib/zadt/AbstractDataTypes/MinMaxStackQueue/Queue.rb
zadt-0.1.6 lib/zadt/AbstractDataTypes/MinMaxStackQueue/Queue.rb
zadt-0.1.5 lib/zadt/AbstractDataTypes/MinMaxStackQueue/Queue.rb
zadt-0.1.4 lib/zadt/AbstractDataTypes/MinMaxStackQueue/Queue.rb
zadt-0.1.3 lib/zadt/AbstractDataTypes/MinMaxStackQueue/Queue.rb
zadt-0.1.2 lib/zadt/AbstractDataTypes/MinMaxStackQueue/Queue.rb