Method: String#esc_split

Defined in:
lib/nerdz/config.rb

#esc_split(s) ⇒ Object



21
22
23
24
25
26
27
28
# File 'lib/nerdz/config.rb', line 21

def esc_split(s)
  return if s.size != 1
  e = Regexp.escape(s.to_s)

  self.scan(/(?:((?:\\#{e}|[^#{e}])*)(?:$|#{e}))/).flatten.tap {|res|
    break res[0..-2] if !self.end_with?(s.to_s)
  }
end