Sha256: 53dbe0b64fd0c926ecf7b973fabe0f99df1986e913cf60325adb2b4d6cf13b44

Contents?: true

Size: 336 Bytes

Versions: 4

Compression:

Stored size: 336 Bytes

Contents

module RubyCollections
  class Stack

    def initialize(arr = [])
      @arr = arr
    end

    def size
      @arr.size
    end

    def isEmpty?
      @arr.size.zero?
    end

    def top
      @arr[0]
    end

    def push(e)
      @arr.unshift(e)
    end

    def pop
      @arr.shift
    end

  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
ruby_collections-0.0.6 lib/ruby_collections/stack.rb
ruby_collections-0.0.5 lib/ruby_collections/stack.rb
ruby_collections-0.0.4 lib/ruby_collections/stack.rb
ruby_collections-0.0.3 lib/ruby_collections/stack.rb