class InfluxDB::LineProtocol::Unescapes
Public Instance Methods
unescape(field, str)
click to toggle source
# File lib/influxdb/lineprotocol/parser.rb, line 686 def unescape(field, str) case field when :measurement # 1. escaped hash, null, or tab at the beginning # 2. escaped comma, space, or newline anywhere # 3. escaped backslash at the end str .sub(/^\\([#\0\t])/, '\\1') .gsub(/\\([, \n])/, '\\1') .sub(/\\\\$/, '\\') when :tag_key, :tag_value # 1. escaped comma, equals, newline, or space anywhere # 2. escaped backslash at the end str .gsub(/\\([,=\n ])/, '\\1') .sub(/\\\\$/, '\\') when :field_key # 1. escaped null or tab at beginning # 2. escaped comma, equals, newline, or space anywhere # 3. escaped backslash at the end str .sub(/^\\([\0\t])/, '\\1') .gsub(/\\([,=\n ])/, '\\1') .sub(/\\\\$/, '\\') when :string # escaped quote anywhere str.gsub(/\\"/, '"') end end