Method: JSONtoDB::CLI.tokenize_command
- Defined in:
- lib/jsontodb/cli.rb
.tokenize_command(input) ⇒ Object
46 47 48 49 50 |
# File 'lib/jsontodb/cli.rb', line 46 def tokenize_command(input) input.split(/\s(?=(?:[^'"]|'[^']*'|"[^"]*")*$)/) .select { |s| !s.empty? } .map { |s| s.gsub(/(^ +)|( +$)|(^["']+)|(["']+$)/, '') } end |