toml-rb 0.1.2 → 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +8 -8
- data/README.md +27 -2
- data/lib/toml.rb +14 -6
- data/lib/toml/dumper.rb +5 -5
- data/lib/toml/grammars/helper.citrus +1 -1
- data/lib/toml/keygroup.rb +6 -2
- data/lib/toml/keyvalue.rb +6 -3
- data/lib/toml/parser.rb +12 -7
- data/lib/toml/string.rb +6 -6
- data/test/dumper_test.rb +15 -17
- data/test/grammar_test.rb +19 -17
- data/test/hard_example.toml +4 -6
- data/test/helper.rb +2 -2
- data/test/toml_test.rb +43 -43
- data/toml-rb.gemspec +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
ZTg0ZGY1MTk0NzM3MjAxZThkZjRhNWU2MGMxODM2OTBhMTkwZTJiYQ==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
YTgwMDkwYzQ5ZDExNTJlYjJjMWZkZjFjOTU4MzY5N2I5MWI3MWQ2Zg==
|
7
7
|
!binary "U0hBNTEy":
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
YjYyYTczYjRhZGFlMzg2MjU0NjdjZDZkOWE2ZDQ2YmUxNjVlNTUxMDMxNTY5
|
10
|
+
ZGIxZDgyZjU3YmQ4MjYwMjgwZjVhN2NjMGNjZTBlNGQ3OWU3M2U5MzdiMzM3
|
11
|
+
NTJhNjI0ZjQxZWQ1YjQ5NTMzZjY3NGYxYWNmNWU3NzlmYjQxZGE=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
NjY3ODY1MDA4Y2M5ZWE1ZWZhNGE2ZGQ3ZjkxMjBmODVkM2EzNDRiNjc2ZTE4
|
14
|
+
Mjk4ZGYzZmZhNjhjMjE0MDMxODk3NTg1MDM5MTkyYzgyMGQ0Y2MyZGE0M2Ji
|
15
|
+
MzEyNzYwZjQzZTU5NTE1YTc4NDNhMTkxYTg4ZWRhNGY3ZmNkMmY=
|
data/README.md
CHANGED
@@ -11,8 +11,8 @@ Installation
|
|
11
11
|
|
12
12
|
$ gem install toml-rb
|
13
13
|
|
14
|
-
Usage
|
15
|
-
|
14
|
+
Parser Usage
|
15
|
+
------------
|
16
16
|
|
17
17
|
```ruby
|
18
18
|
require 'toml'
|
@@ -30,12 +30,37 @@ stream = <<-EOS
|
|
30
30
|
others = false
|
31
31
|
EOS
|
32
32
|
TOML.parse(stream)
|
33
|
+
# => {"title"=>"wow!", "awesome"=>{"you"=>true, "others"=>false}}
|
33
34
|
|
34
35
|
# You want symbols as your keys? No problem!
|
35
36
|
TOML.load_file(path, symbolize_keys: true)
|
36
37
|
# Works the same for TOML.parse
|
37
38
|
```
|
38
39
|
|
40
|
+
Dumper Usage
|
41
|
+
------------
|
42
|
+
|
43
|
+
```ruby
|
44
|
+
require 'toml'
|
45
|
+
|
46
|
+
# Simple example
|
47
|
+
TOML.dump( simple: true)
|
48
|
+
# => "simple = true\n"
|
49
|
+
|
50
|
+
|
51
|
+
# Complex example
|
52
|
+
hash = {
|
53
|
+
"title"=>"wow!",
|
54
|
+
"awesome"=> {
|
55
|
+
"you"=>true,
|
56
|
+
"others"=>false
|
57
|
+
}
|
58
|
+
}
|
59
|
+
|
60
|
+
TOML.dump(hash)
|
61
|
+
# => "title = \"wow!\"\n[awesome]\nothers = false\nyou = true\n"
|
62
|
+
```
|
63
|
+
|
39
64
|
Contributing
|
40
65
|
------------
|
41
66
|
|
data/lib/toml.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
require_relative
|
1
|
+
require_relative '../init'
|
2
2
|
|
3
3
|
module TOML
|
4
4
|
|
@@ -62,15 +62,23 @@ module TOML
|
|
62
62
|
#
|
63
63
|
# Examples
|
64
64
|
#
|
65
|
-
# TOML.dump(
|
66
|
-
# # =>
|
65
|
+
# TOML.dump(title: 'TOML dump')
|
66
|
+
# # => "simple = true\n"
|
67
67
|
#
|
68
|
-
#
|
69
|
-
#
|
68
|
+
# hash = {
|
69
|
+
# "title"=>"wow!",
|
70
|
+
# "awesome"=> {
|
71
|
+
# "you"=>true,
|
72
|
+
# "others"=>false
|
73
|
+
# }
|
74
|
+
# }
|
75
|
+
#
|
76
|
+
# TOML.dump(hash)
|
77
|
+
# # => "title = \"wow!\"\n[awesome]\nothers = false\nyou = true\n"
|
70
78
|
#
|
71
79
|
#
|
72
80
|
# Returns a TOML string representing the hash.
|
73
81
|
def self.dump(hash)
|
74
|
-
Dumper.new(hash)
|
82
|
+
Dumper.new(hash).toml_str
|
75
83
|
end
|
76
84
|
end
|
data/lib/toml/dumper.rb
CHANGED
@@ -3,7 +3,7 @@ module TOML
|
|
3
3
|
attr_reader :toml_str
|
4
4
|
|
5
5
|
def initialize(hash)
|
6
|
-
@toml_str =
|
6
|
+
@toml_str = ''
|
7
7
|
|
8
8
|
visit(hash, '')
|
9
9
|
end
|
@@ -22,12 +22,12 @@ module TOML
|
|
22
22
|
@toml_str += "[#{prefix}]\n" unless prefix.empty? || simple_pairs.empty?
|
23
23
|
|
24
24
|
# First add simple pairs, under the prefix
|
25
|
-
simple_pairs.each do |
|
26
|
-
@toml_str << "#{
|
25
|
+
simple_pairs.each do |key, val|
|
26
|
+
@toml_str << "#{key.to_s} = #{to_toml(val)}\n"
|
27
27
|
end
|
28
28
|
|
29
|
-
nested_pairs.each do |
|
30
|
-
visit(
|
29
|
+
nested_pairs.each do |key, val|
|
30
|
+
visit(val, prefix.empty? ? key.to_s : [prefix, key].join('.'))
|
31
31
|
end
|
32
32
|
end
|
33
33
|
|
data/lib/toml/keygroup.rb
CHANGED
@@ -13,12 +13,16 @@ module TOML
|
|
13
13
|
|
14
14
|
hash
|
15
15
|
end
|
16
|
+
|
17
|
+
def accept_visitor(parser)
|
18
|
+
parser.visit_keygroup(self)
|
19
|
+
end
|
16
20
|
end
|
17
21
|
end
|
18
22
|
|
19
|
-
# Used in
|
23
|
+
# Used in document.citrus
|
20
24
|
module Keygroup
|
21
25
|
def value
|
22
|
-
TOML::Keygroup.new(nested_keys.to_s.split(
|
26
|
+
TOML::Keygroup.new(nested_keys.to_s.split('.'))
|
23
27
|
end
|
24
28
|
end
|
data/lib/toml/keyvalue.rb
CHANGED
@@ -7,15 +7,18 @@ module TOML
|
|
7
7
|
end
|
8
8
|
|
9
9
|
def assign(hash, symbolize_keys = false)
|
10
|
-
raise ValueOverwriteError if hash[@key]
|
11
|
-
|
12
10
|
key = symbolize_keys ? @key.to_sym : @key
|
11
|
+
raise ValueOverwriteError if hash[key]
|
13
12
|
hash[key] = @value
|
14
13
|
end
|
14
|
+
|
15
|
+
def accept_visitor(parser)
|
16
|
+
parser.visit_keyvalue(self)
|
17
|
+
end
|
15
18
|
end
|
16
19
|
end
|
17
20
|
|
18
|
-
# Used in
|
21
|
+
# Used in document.citrus
|
19
22
|
module Keyvalue
|
20
23
|
def value
|
21
24
|
TOML::Keyvalue.new(key.value, v.value)
|
data/lib/toml/parser.rb
CHANGED
@@ -5,15 +5,20 @@ module TOML
|
|
5
5
|
def initialize(content, options = {})
|
6
6
|
@hash = {}
|
7
7
|
@current = @hash
|
8
|
+
@symbolize_keys = options[:symbolize_keys]
|
8
9
|
|
9
10
|
parsed = Document.parse(content)
|
10
|
-
parsed.matches.map(&:value).compact.each
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
11
|
+
parsed.matches.map(&:value).compact.each { |m| m.accept_visitor(self) }
|
12
|
+
end
|
13
|
+
|
14
|
+
# Read about the Visitor pattern
|
15
|
+
# http://en.wikipedia.org/wiki/Visitor_pattern
|
16
|
+
def visit_keygroup(keygroup)
|
17
|
+
@current = keygroup.navigate_keys(@hash, @symbolize_keys)
|
18
|
+
end
|
19
|
+
|
20
|
+
def visit_keyvalue(keyvalue)
|
21
|
+
keyvalue.assign(@current, @symbolize_keys)
|
17
22
|
end
|
18
23
|
end
|
19
24
|
end
|
data/lib/toml/string.rb
CHANGED
@@ -5,15 +5,15 @@ module TomlString
|
|
5
5
|
s = 0
|
6
6
|
o = []
|
7
7
|
while s < aux.length
|
8
|
-
if aux[s] ==
|
8
|
+
if aux[s] == '\\'
|
9
9
|
s += 1
|
10
10
|
case aux[s]
|
11
|
-
when
|
12
|
-
when
|
13
|
-
when
|
11
|
+
when 't' then o << "\t"
|
12
|
+
when 'n' then o << "\n"
|
13
|
+
when '\\' then o << '\\'
|
14
14
|
when '"' then o << '"'
|
15
|
-
when
|
16
|
-
when
|
15
|
+
when 'r' then o << "\r"
|
16
|
+
when '0' then o << "\0"
|
17
17
|
else
|
18
18
|
o << '\\' << aux[s]
|
19
19
|
end
|
data/test/dumper_test.rb
CHANGED
@@ -4,45 +4,43 @@ class DumperTest < Test::Unit::TestCase
|
|
4
4
|
|
5
5
|
def test_dump_empty
|
6
6
|
dumped = TOML.dump({})
|
7
|
-
assert_equal('', dumped
|
7
|
+
assert_equal('', dumped)
|
8
8
|
end
|
9
9
|
|
10
10
|
def test_dump_types
|
11
11
|
dumped = TOML.dump(string: %q(TOML "dump"))
|
12
|
-
assert_equal("string = \"TOML \\\"dump\\\"\"\n", dumped
|
12
|
+
assert_equal("string = \"TOML \\\"dump\\\"\"\n", dumped)
|
13
13
|
|
14
14
|
dumped = TOML.dump(float: -13.24)
|
15
|
-
assert_equal("float = -13.24\n", dumped
|
15
|
+
assert_equal("float = -13.24\n", dumped)
|
16
16
|
|
17
17
|
dumped = TOML.dump(int: 1234)
|
18
|
-
assert_equal("int = 1234\n", dumped
|
18
|
+
assert_equal("int = 1234\n", dumped)
|
19
19
|
|
20
20
|
dumped = TOML.dump(true: true)
|
21
|
-
assert_equal("true = true\n", dumped
|
21
|
+
assert_equal("true = true\n", dumped)
|
22
22
|
|
23
23
|
dumped = TOML.dump(false: false)
|
24
|
-
assert_equal("false = false\n", dumped
|
24
|
+
assert_equal("false = false\n", dumped)
|
25
25
|
|
26
|
-
dumped = TOML.dump(array: [1,2,3])
|
27
|
-
assert_equal("array = [1, 2, 3]\n", dumped
|
26
|
+
dumped = TOML.dump(array: [1, 2, 3])
|
27
|
+
assert_equal("array = [1, 2, 3]\n", dumped)
|
28
28
|
|
29
|
-
dumped = TOML.dump(array: [[1,2], [
|
30
|
-
assert_equal("array = [[1, 2], [\"weird\", \"one\"]]\n", dumped
|
29
|
+
dumped = TOML.dump(array: [[1, 2], ['weird', 'one']])
|
30
|
+
assert_equal("array = [[1, 2], [\"weird\", \"one\"]]\n", dumped)
|
31
31
|
|
32
|
-
dumped = TOML.dump(datetime: Time.utc(1986,8,28,15,15))
|
33
|
-
assert_equal("datetime = 1986-08-28T15:15:00Z\n", dumped
|
32
|
+
dumped = TOML.dump(datetime: Time.utc(1986, 8, 28, 15, 15))
|
33
|
+
assert_equal("datetime = 1986-08-28T15:15:00Z\n", dumped)
|
34
34
|
end
|
35
35
|
|
36
36
|
def test_dump_nested_attributes
|
37
37
|
hash = {nested: {hash: { deep: true}}}
|
38
38
|
dumped = TOML.dump(hash)
|
39
|
-
assert_equal("[nested.hash]\ndeep = true\n",
|
40
|
-
dumped.toml_str)
|
39
|
+
assert_equal("[nested.hash]\ndeep = true\n", dumped)
|
41
40
|
|
42
41
|
hash[:nested].merge!(other: 12)
|
43
42
|
dumped = TOML.dump(hash)
|
44
|
-
assert_equal("[nested]\nother = 12\n[nested.hash]\ndeep = true\n",
|
45
|
-
dumped.toml_str)
|
43
|
+
assert_equal("[nested]\nother = 12\n[nested.hash]\ndeep = true\n", dumped)
|
46
44
|
|
47
45
|
hash[:nested].merge!(nest: {again: 'it never ends'})
|
48
46
|
dumped = TOML.dump(hash)
|
@@ -53,6 +51,6 @@ class DumperTest < Test::Unit::TestCase
|
|
53
51
|
"[nested.nest]\n" +
|
54
52
|
"again = \"it never ends\"\n"
|
55
53
|
|
56
|
-
assert_equal(toml, dumped
|
54
|
+
assert_equal(toml, dumped)
|
57
55
|
end
|
58
56
|
end
|
data/test/grammar_test.rb
CHANGED
@@ -1,9 +1,9 @@
|
|
1
|
-
require_relative
|
1
|
+
require_relative 'helper'
|
2
2
|
|
3
3
|
class GrammarTest < Test::Unit::TestCase
|
4
4
|
|
5
5
|
def test_comment
|
6
|
-
match = Document.parse(
|
6
|
+
match = Document.parse(' # A comment', root: :comment)
|
7
7
|
assert_equal(nil, match.value)
|
8
8
|
end
|
9
9
|
|
@@ -11,11 +11,12 @@ class GrammarTest < Test::Unit::TestCase
|
|
11
11
|
indentation_alternatives_for('[akey]') do |str|
|
12
12
|
match = Document.parse(str, root: :keygroup)
|
13
13
|
assert_equal(TOML::Keygroup, match.value.class)
|
14
|
-
assert_equal(['akey'], match.value.instance_variable_get(
|
14
|
+
assert_equal(['akey'], match.value.instance_variable_get('@nested_keys'))
|
15
15
|
end
|
16
16
|
|
17
17
|
match = Document.parse('[owner.emancu]', root: :keygroup)
|
18
|
-
assert_equal(['owner', 'emancu'],
|
18
|
+
assert_equal(['owner', 'emancu'],
|
19
|
+
match.value.instance_variable_get('@nested_keys'))
|
19
20
|
end
|
20
21
|
|
21
22
|
def test_keyvalue
|
@@ -24,14 +25,14 @@ class GrammarTest < Test::Unit::TestCase
|
|
24
25
|
assert_equal(TOML::Keyvalue, match.value.class)
|
25
26
|
|
26
27
|
keyvalue = match.value
|
27
|
-
assert_equal('key', keyvalue.instance_variable_get(
|
28
|
-
assert_equal('value', keyvalue.instance_variable_get(
|
28
|
+
assert_equal('key', keyvalue.instance_variable_get('@key'))
|
29
|
+
assert_equal('value', keyvalue.instance_variable_get('@value'))
|
29
30
|
end
|
30
31
|
end
|
31
32
|
|
32
33
|
def test_string
|
33
34
|
match = Document.parse('"TOML-Example, should work."', root: :string)
|
34
|
-
assert_equal(
|
35
|
+
assert_equal('TOML-Example, should work.', match.value)
|
35
36
|
end
|
36
37
|
|
37
38
|
def test_special_characters
|
@@ -39,7 +40,7 @@ class GrammarTest < Test::Unit::TestCase
|
|
39
40
|
assert_equal("\0 \" \t \n \r", match.value)
|
40
41
|
|
41
42
|
match = Document.parse('"C:\\Documents\\virus.exe"', root: :string)
|
42
|
-
assert_equal(
|
43
|
+
assert_equal('C:\\Documents\\virus.exe', match.value)
|
43
44
|
end
|
44
45
|
|
45
46
|
def test_bool
|
@@ -76,11 +77,12 @@ class GrammarTest < Test::Unit::TestCase
|
|
76
77
|
|
77
78
|
def test_expressions_with_comments
|
78
79
|
match = Document.parse('[shouldwork] # with comment', root: :keygroup)
|
79
|
-
assert_equal(['shouldwork'],
|
80
|
+
assert_equal(['shouldwork'],
|
81
|
+
match.value.instance_variable_get('@nested_keys'))
|
80
82
|
|
81
83
|
match = Document.parse('works = true # with comment', root: :keyvalue).value
|
82
|
-
assert_equal(
|
83
|
-
assert_equal(true, match.instance_variable_get(
|
84
|
+
assert_equal('works', match.instance_variable_get('@key'))
|
85
|
+
assert_equal(true, match.instance_variable_get('@value'))
|
84
86
|
end
|
85
87
|
|
86
88
|
def test_array
|
@@ -88,25 +90,25 @@ class GrammarTest < Test::Unit::TestCase
|
|
88
90
|
assert_equal([], match.value)
|
89
91
|
|
90
92
|
match = Document.parse('[ 2, 4]', root: :array)
|
91
|
-
assert_equal([2,4], match.value)
|
93
|
+
assert_equal([2, 4], match.value)
|
92
94
|
|
93
95
|
match = Document.parse('[ 2.4, 4.72]', root: :array)
|
94
|
-
assert_equal([2.4,4.72], match.value)
|
96
|
+
assert_equal([2.4, 4.72], match.value)
|
95
97
|
|
96
98
|
match = Document.parse('[ "hey", "TOML"]', root: :array)
|
97
|
-
assert_equal([
|
99
|
+
assert_equal(['hey', 'TOML'], match.value)
|
98
100
|
|
99
101
|
match = Document.parse('[ ["hey", "TOML"], [2,4] ]', root: :array)
|
100
|
-
assert_equal([[
|
102
|
+
assert_equal([['hey', 'TOML'], [2, 4]], match.value)
|
101
103
|
|
102
104
|
multiline_array = "[ \"hey\",\n \"ho\",\n\t \"lets\", \"go\",\n ]"
|
103
105
|
match = Document.parse(multiline_array, root: :array)
|
104
|
-
assert_equal([
|
106
|
+
assert_equal(['hey', 'ho', 'lets', 'go'], match.value)
|
105
107
|
end
|
106
108
|
|
107
109
|
def test_datetime
|
108
110
|
match = Document.parse('1986-08-28T15:15:00Z', root: :datetime)
|
109
|
-
assert_equal(Time.utc(1986,8,28,15,15), match.value)
|
111
|
+
assert_equal(Time.utc(1986, 8, 28, 15, 15), match.value)
|
110
112
|
end
|
111
113
|
|
112
114
|
private
|
data/test/hard_example.toml
CHANGED
@@ -6,11 +6,11 @@
|
|
6
6
|
test_string = "You'll hate me after this - #" # " Annoying, isn't it?
|
7
7
|
|
8
8
|
[the.hard]
|
9
|
-
|
10
|
-
|
9
|
+
array = [ "] ", " # "] # ] There you go, parse this!
|
10
|
+
array2 = [ "Test #11 ]proved that", "Experiment #9 was a success" ]
|
11
11
|
# You didn't think it'd as easy as chucking out the last #, did you?
|
12
|
-
|
13
|
-
|
12
|
+
another_string = " Same thing, but with a string #"
|
13
|
+
harder_string = "And when \"'s are in the string, along with # \"" # "and comments are there too"
|
14
14
|
# Things will get harder
|
15
15
|
|
16
16
|
[the.hard.bit#]
|
@@ -19,5 +19,3 @@ test_string = "You'll hate me after this - #" # " Annoying, isn't it?
|
|
19
19
|
"]",
|
20
20
|
# ] Oh yes I did
|
21
21
|
]
|
22
|
-
|
23
|
-
# Each of the following keygroups/key value pairs should produce an error. Uncomment to them to test
|
data/test/helper.rb
CHANGED
@@ -1,2 +1,2 @@
|
|
1
|
-
require
|
2
|
-
require_relative
|
1
|
+
require 'test/unit'
|
2
|
+
require_relative '../lib/toml'
|
data/test/toml_test.rb
CHANGED
@@ -6,36 +6,36 @@ class TomlTest < Test::Unit::TestCase
|
|
6
6
|
parsed = TOML.load_file(path)
|
7
7
|
|
8
8
|
hash = {
|
9
|
-
|
9
|
+
'title' => 'TOML Example',
|
10
10
|
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
11
|
+
'owner' => {
|
12
|
+
'name' => 'Tom Preston-Werner',
|
13
|
+
'organization' => 'GitHub',
|
14
|
+
'bio' => "GitHub Cofounder & CEO\nLikes tater tots and beer.",
|
15
|
+
'dob' => Time.utc(1979, 05, 27, 07, 32, 00)
|
16
16
|
},
|
17
17
|
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
18
|
+
'database' => {
|
19
|
+
'server' => '192.168.1.1',
|
20
|
+
'ports' => [8001, 8001, 8002],
|
21
|
+
'connection_max' => 5000,
|
22
|
+
'enabled' => true
|
23
23
|
},
|
24
24
|
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
25
|
+
'servers' => {
|
26
|
+
'alpha' => {
|
27
|
+
'ip' => '10.0.0.1',
|
28
|
+
'dc' => 'eqdc10'
|
29
29
|
},
|
30
|
-
|
31
|
-
|
32
|
-
|
30
|
+
'beta' => {
|
31
|
+
'ip' => '10.0.0.2',
|
32
|
+
'dc' => 'eqdc10'
|
33
33
|
}
|
34
34
|
},
|
35
35
|
|
36
|
-
|
37
|
-
|
38
|
-
|
36
|
+
'clients' => {
|
37
|
+
'data' => [['gamma', 'delta'], [1, 2]],
|
38
|
+
'hosts' => ['alpha', 'omega']
|
39
39
|
}
|
40
40
|
}
|
41
41
|
|
@@ -47,16 +47,16 @@ class TomlTest < Test::Unit::TestCase
|
|
47
47
|
parsed = TOML.load_file(path)
|
48
48
|
|
49
49
|
hash = {
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
50
|
+
'the' => {
|
51
|
+
'test_string' => "You'll hate me after this - #",
|
52
|
+
'hard' => {
|
53
|
+
'array' => ['] ', ' # '],
|
54
|
+
'array2' => ['Test #11 ]proved that', 'Experiment #9 was a success'],
|
55
|
+
'another_string' => ' Same thing, but with a string #',
|
56
|
+
'harder_string' => "And when \"'s are in the string, along with # \"",
|
57
|
+
'bit#' => {
|
58
|
+
'what?' => "You don't think some user won't do that?",
|
59
|
+
'multi_line_array' => [']']
|
60
60
|
}
|
61
61
|
}
|
62
62
|
}
|
@@ -70,36 +70,36 @@ class TomlTest < Test::Unit::TestCase
|
|
70
70
|
parsed = TOML.load_file(path, symbolize_keys: true)
|
71
71
|
|
72
72
|
hash = {
|
73
|
-
title:
|
73
|
+
title: 'TOML Example',
|
74
74
|
|
75
75
|
owner: {
|
76
|
-
name:
|
77
|
-
organization:
|
76
|
+
name: 'Tom Preston-Werner',
|
77
|
+
organization: 'GitHub',
|
78
78
|
bio: "GitHub Cofounder & CEO\nLikes tater tots and beer.",
|
79
|
-
dob: Time.utc(1979,05,27,07,32,00)
|
79
|
+
dob: Time.utc(1979, 05, 27, 07, 32, 00)
|
80
80
|
},
|
81
81
|
|
82
82
|
database: {
|
83
|
-
server:
|
84
|
-
ports: [
|
83
|
+
server: '192.168.1.1',
|
84
|
+
ports: [8001, 8001, 8002],
|
85
85
|
connection_max: 5000,
|
86
86
|
enabled: true
|
87
87
|
},
|
88
88
|
|
89
89
|
servers: {
|
90
90
|
alpha: {
|
91
|
-
ip:
|
92
|
-
dc:
|
91
|
+
ip: '10.0.0.1',
|
92
|
+
dc: 'eqdc10'
|
93
93
|
},
|
94
94
|
beta: {
|
95
|
-
ip:
|
96
|
-
dc:
|
95
|
+
ip: '10.0.0.2',
|
96
|
+
dc: 'eqdc10'
|
97
97
|
}
|
98
98
|
},
|
99
99
|
|
100
100
|
clients: {
|
101
|
-
data: [[
|
102
|
-
hosts: [
|
101
|
+
data: [['gamma', 'delta'], [1, 2]],
|
102
|
+
hosts: ['alpha', 'omega']
|
103
103
|
}
|
104
104
|
}
|
105
105
|
|
data/toml-rb.gemspec
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = 'toml-rb'
|
3
|
-
s.version = '0.1.
|
3
|
+
s.version = '0.1.3'
|
4
4
|
s.date = Time.now.strftime('%Y-%m-%d')
|
5
5
|
s.summary = "TOML parser in ruby, for ruby."
|
6
6
|
s.description = "A TOML parser using Citrus parsing library. Formerly known as 'toml_parser-ruby'. "
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: toml-rb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Emiliano Mancuso
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-
|
12
|
+
date: 2013-05-07 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: citrus
|