class ImmutableStack::ImmutableStack

Attributes

list[RW]
temporal_list[RW]

Public Class Methods

new(list) click to toggle source
# File lib/immutable_stack.rb, line 11
def initialize(list)
        self.list = list
        self.temporal_list = list.dup
        self.list.freeze
end

Public Instance Methods

pop() click to toggle source
# File lib/immutable_stack.rb, line 17
def pop()
        self.temporal_list.pop()
end
push(value) click to toggle source
# File lib/immutable_stack.rb, line 21
def push(value)
        self.temporal_list.push(value)
end