configparser 0.1.5 → 0.1.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/configparser.rb +1 -0
- data/lib/configparser/version.rb +1 -1
- data/test/test_configparser.rb +45 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 963a2aeb71783101be9ff9da4eae8ab8f237471e
|
4
|
+
data.tar.gz: 6280b7525c83c1d1d3a1723c0af4be3c7ee88ae3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 56a5b36b5ba0bf411945af98586dc0d9a0cc33f3d7157e3277191cfbd5222689c0e41c14c27fb983db78822c3e673bb642283d501c94ec4b05080c6493f14ba0
|
7
|
+
data.tar.gz: ac46e308fdd5e3387b325f91982c7b637559374bb4036d00d32dc6b444dab15a271bd50633e0316042f0fa8b1c33524afd042b2e1672fef0e80ba5d6758f79d1
|
data/lib/configparser.rb
CHANGED
data/lib/configparser/version.rb
CHANGED
data/test/test_configparser.rb
CHANGED
@@ -107,6 +107,7 @@ spaces around the delimiter: obviously
|
|
107
107
|
spaces in keys: allowed
|
108
108
|
spaces in values: allowed as well
|
109
109
|
you can also use: to delimit keys from values
|
110
|
+
[You can use comments]
|
110
111
|
"
|
111
112
|
|
112
113
|
assert_equal(doc, cp.to_s)
|
@@ -125,4 +126,48 @@ end_of_simple
|
|
125
126
|
}}, cp)
|
126
127
|
assert_equal(nil_content, cp.to_s("="))
|
127
128
|
end
|
129
|
+
|
130
|
+
def test_from_python_cfgparser
|
131
|
+
content = <<end_of_python_example
|
132
|
+
[Foo Bar]
|
133
|
+
foo=bar
|
134
|
+
[Spacey Bar]
|
135
|
+
foo = bar
|
136
|
+
[Commented Bar]
|
137
|
+
foo: bar ; comment
|
138
|
+
[Long Line]
|
139
|
+
foo: this line is much, much longer than my editor
|
140
|
+
likes it.
|
141
|
+
[Section\\with$weird%characters[\t]
|
142
|
+
[Internationalized Stuff]
|
143
|
+
foo[bg]: Bulgarian
|
144
|
+
foo=Default
|
145
|
+
foo[en]=English
|
146
|
+
foo[de]=Deutsch
|
147
|
+
[Spaces]
|
148
|
+
key with spaces : value
|
149
|
+
another with spaces = splat!
|
150
|
+
end_of_python_example
|
151
|
+
cp = ConfigParser.new()
|
152
|
+
cp.parse(content.each_line)
|
153
|
+
doc = "[Commented Bar]
|
154
|
+
foo: bar ; comment
|
155
|
+
[Foo Bar]
|
156
|
+
foo: bar
|
157
|
+
[Internationalized Stuff]
|
158
|
+
foo: Default
|
159
|
+
foo[bg]: Bulgarian
|
160
|
+
foo[de]: Deutsch
|
161
|
+
foo[en]: English
|
162
|
+
[Long Line]
|
163
|
+
foo: this line is much, much longer than my editor likes it.
|
164
|
+
[Section\\with$weird%characters[\t]
|
165
|
+
[Spaces]
|
166
|
+
another with spaces: splat!
|
167
|
+
key with spaces: value
|
168
|
+
[Spacey Bar]
|
169
|
+
foo: bar
|
170
|
+
"
|
171
|
+
assert_equal(doc, cp.to_s)
|
172
|
+
end
|
128
173
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: configparser
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- chrislee35
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-01-
|
11
|
+
date: 2017-01-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: minitest
|