Sha256: df7183dc44cf1adade382699e0bef11828af588318c3d3cfedc82f76692ba47c

Contents?: true

Size: 637 Bytes

Versions: 2

Compression:

Stored size: 637 Bytes

Contents

module ZagorskiADT
  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

2 entries across 2 versions & 1 rubygems

Version Path
ZagorskiADT-0.1.4 lib/ZagorskiADT/AbstractDataTypes/Queue.rb
ZagorskiADT-0.1.3 lib/ZagorskiADT/AbstractDataTypes/Queue.rb