Class: Simrb::Scommand

Inherits:
Object
  • Object
show all
Defined in:
lib/simrb/comd.rb

Instance Method Summary collapse

Instance Method Details

#run(args = []) ⇒ Object

run the command

Example

sapp = Simrb::Scommand.new sapp.run ARGV



17
18
19
20
21
22
23
24
25
26
27
# File 'lib/simrb/comd.rb', line 17

def run args = []
  cmd = args.empty? ? '' : args.shift
  if Scommand.private_method_defined? cmd
    self.send(cmd, args)
  elsif cmd == "help"
    require 'simrb/docs'
    Simrb.help args
  else
    puts "No command called #{cmd}, please try `$ simrb help`"
  end
end