class Reflekt::ActionStack

Public Class Methods

new() click to toggle source
# File lib/action_stack.rb, line 10
def initialize()
  @bottom = nil
  @top = nil
end

Public Instance Methods

base() click to toggle source
# File lib/action_stack.rb, line 19
def base()
  @bottom
end
peek() click to toggle source
# File lib/action_stack.rb, line 15
def peek()
  @top
end
push(action) click to toggle source

Place Action at the top of stack.

@param action [Action] The action to place. @return [Action] The placed action.

# 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