Class: Raheui::Stack
Overview
Stack class for Aheui.
Instance Method Summary collapse
-
#push_dup ⇒ Object
Push the last element to Stack.
-
#swap ⇒ Object
Swap the last two elements of Stack.
Methods inherited from Store
Constructor Details
This class inherits a constructor from Raheui::Store
Instance Method Details
#push_dup ⇒ Object
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 |
#swap ⇒ Object
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 |