Module: StdCmd::Mode

Defined in:
lib/command-set/standard-commands.rb

Constant Summary collapse

@@set =
nil

Class Method Summary collapse

Class Method Details

.define_commandsObject



129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
# File 'lib/command-set/standard-commands.rb', line 129

def self.define_commands
  return @@set ||= Command::CommandSet.define_commands do
    root_command do
      subject_methods :interpreter
      doesnt_undo

      action do
        subject.interpreter.push_mode(nesting)
      end
    end

    mode_command(:exit) do
      subject_methods :interpreter
      doesnt_undo

      action do
        subject.interpreter.pop_mode
      end
    end
  end  
end