Method: Autoweb::Command.parse
- Defined in:
- lib/autoweb/command.rb
.parse(command) ⇒ Object
50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 |
# File 'lib/autoweb/command.rb', line 50 def parse(command) parts = command.split(':') case parts.size when 1 begin return eval("Autoweb::Command::#{command.capitalize}"), :index #rescue NameError, NoMethodError # return Autoweb::Command::Help, command end when 2 begin return Autoweb::Command.const_get(parts[0].capitalize), parts[1] rescue NameError raise InvalidCommand end else raise InvalidCommand end end |