Class: TomlRB::Dumper

Inherits:
Object
  • Object
show all
Defined in:
lib/toml-rb/dumper.rb

Constant Summary collapse

BASIC_ESCAPES =

TOML basic strings only allow these short escapes; every other control character must be written as \uXXXX (TOML 1.0.0 spec).

{
  "\\" => "\\\\",
  "\"" => "\\\"",
  "\b" => "\\b",
  "\t" => "\\t",
  "\n" => "\\n",
  "\f" => "\\f",
  "\r" => "\\r"
}.freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(hash) ⇒ Dumper

Returns a new instance of Dumper.



21
22
23
24
25
# File 'lib/toml-rb/dumper.rb', line 21

def initialize(hash)
  @toml_str = ""

  visit(hash, [])
end

Instance Attribute Details

#toml_strObject (readonly)

Returns the value of attribute toml_str.



19
20
21
# File 'lib/toml-rb/dumper.rb', line 19

def toml_str
  @toml_str
end