Class: Reflekt::ActionStack
- Inherits:
-
Object
- Object
- Reflekt::ActionStack
- Defined in:
- lib/action_stack.rb
Instance Method Summary collapse
- #base ⇒ Object
-
#initialize ⇒ ActionStack
constructor
A new instance of ActionStack.
- #peek ⇒ Object
-
#push(action) ⇒ Action
Place Action at the top of stack.
Constructor Details
#initialize ⇒ ActionStack
Returns a new instance of ActionStack.
10 11 12 13 |
# File 'lib/action_stack.rb', line 10 def initialize() @bottom = nil @top = nil end |
Instance Method Details
#base ⇒ Object
19 20 21 |
# File 'lib/action_stack.rb', line 19 def base() @bottom end |
#peek ⇒ Object
15 16 17 |
# File 'lib/action_stack.rb', line 15 def peek() @top end |
#push(action) ⇒ Action
Place Action at the top of stack.
29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/action_stack.rb', line 29 def push(action) # First time? Place action at bottom of stack. if @bottom.nil? @bottom = action # Connect subsequent actions to each other. else @top.parent = action action.child = @top end # Place action at top of stack. @top = action end |