Class: String

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

Instance Method Summary collapse

Instance Method Details

#tokenizeObject



20
21
22
23
24
25
# File 'lib/ecs_cmd/utils.rb', line 20

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