Module: Zendesk::CommandParser

Extended by:
CommandParser
Included in:
CommandParser
Defined in:
lib/zendesk/command_parser.rb

Instance Method Summary collapse

Instance Method Details

#parse(command) ⇒ Object


7
8
9
10
11
12
13
14
15
# File 'lib/zendesk/command_parser.rb', line 7

def parse(command)
  command_ast = tokenize command

  raise Zendesk::Error, 'invalid command' if command_ast.empty?

  command_ast
rescue Exception => e
  raise Zendesk::Error, "parse error #{e.message}"
end