Class: DeeperHash::Diff::Stack

Inherits:
Object
  • Object
show all
Defined in:
lib/deeper_hash/diff.rb

Instance Method Summary collapse

Constructor Details

#initializeStack

Returns a new instance of Stack.



6
7
8
# File 'lib/deeper_hash/diff.rb', line 6

def initialize
  @stack = []
end

Instance Method Details

#popObject



14
15
16
17
18
# File 'lib/deeper_hash/diff.rb', line 14

def pop
  return if @stack.empty?

  @stack = @stack[0..-2]
end

#push(value) ⇒ Object



10
11
12
# File 'lib/deeper_hash/diff.rb', line 10

def push(value)
  @stack << value
end

#to_aObject



20
21
22
# File 'lib/deeper_hash/diff.rb', line 20

def to_a
  @stack
end