class String
Public Instance Methods
split_with_quotes(sep = '\s', q = '\'"')
click to toggle source
# File lib/cless/cless.rb, line 34 def split_with_quotes(sep = '\s', q = '\'"') r = / \G(?:^|[#{sep}]) # anchor the match (?: [#{q}]((?>[^#{q}]*)(?>""[^#{q}]*)*)[#{q}] # find quoted fields | # ... or ... ([^#{q}#{sep}]*) # unquoted fields )/x self.split(r).delete_if { |x| x.empty? } end