Sha256: 6dd8f1ddf5911782574b12642fd4396acd0a24e95bec1da9c8c9136d68716c12

Contents?: true

Size: 630 Bytes

Versions: 1

Compression:

Stored size: 630 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

1 entries across 1 versions & 1 rubygems

Version Path
zadt-0.1.1 lib/zadt/AbstractDataTypes/Queue.rb