Class: Raheui::Stack

Inherits:
Store
  • Object
show all
Defined in:
lib/raheui/stack.rb

Overview

Stack class for Aheui.

Instance Method Summary collapse

Methods inherited from Store

#initialize

Constructor Details

This class inherits a constructor from Raheui::Store

Instance Method Details

#push_dupObject

Push the last element to Stack.



10
11
12
# File 'lib/raheui/stack.rb', line 10

def push_dup
  push(@store.last) if size > 0
end

#swapObject

Swap the last two elements of Stack.



15
16
17
# File 'lib/raheui/stack.rb', line 15

def swap
  @store[-1], @store[-2] = @store[-2], @store[-1] if size > 1
end