Method: Command::BaseInterpreter#push_mode

Defined in:
lib/command-set/interpreter/base.rb

#push_mode(nesting) ⇒ Object

Puts a CommandSet ahead of the current one for processing. Useful for command

modes, like Cisco's IOS with configure modes, et al.


75
76
77
78
79
80
81
82
83
# File 'lib/command-set/interpreter/base.rb', line 75

def push_mode(nesting)
  mode = nesting.pop
  unless CommandSet === mode
    raise RuntimeError, "Sub-modes must be CommandSets!" 
  end

  sub_modes.push([mode, mode.most_recent_args, nesting])
  return nil
end