Module: TomlString

Defined in:
lib/toml/string.rb

Overview

Used in primitive.citrus

Instance Method Summary collapse

Instance Method Details

#valueObject



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/toml/string.rb', line 3

def value
  aux = first.value
  s = 0
  o = []
  while s < aux.length
    if aux[s] == "\\"
      s += 1
      case aux[s]
      when "t" then o << "\t"
      when "n" then o << "\n"
      when "\\" then o << "\\"
      when '"' then o << '"'
      when "r" then o << "\r"
      when "0" then o << "\0"
      else
        o << '\\' << aux[s]
      end
    else
      o << aux[s]
    end
    s += 1
  end
  o[1...-1].join
end