Class: String

Inherits:
Object
  • Object
show all
Defined in:
lib/ecs_cmd/utils.rb

Instance Method Summary collapse

Instance Method Details

#tokenizeObject



18
19
20
21
22
23
# File 'lib/ecs_cmd/utils.rb', line 18

def tokenize
  self.
    split(/\s(?=(?:[^'"]|'[^']*'|"[^"]*")*$)/).
    select {|s| not s.empty? }.
    map {|s| s.gsub(/(^ +)|( +$)|(^["']+)|(["']+$)/,'')}
end