yaml-write-stream 1.0.3 → 1.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/History.txt +4 -0
- data/lib/yaml-write-stream/stateful.rb +7 -3
- data/lib/yaml-write-stream/version.rb +1 -1
- data/lib/yaml-write-stream/yielding.rb +7 -3
- data/spec/stateful_spec.rb +1 -1
- metadata +13 -14
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5150ab0601006ad44967a247d05199fd95a260fa
|
4
|
+
data.tar.gz: f512124a33caaf8ca2ea52920ce63879d43d1c8e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6b0ab08d6209fa31bb09a24168ee03abfc81a4eb852100a57c8e63a7e5f4ec5099f30390e30e5a4414c4a8f3677c5b8fadd3247a29c52d61f684804509d3a357
|
7
|
+
data.tar.gz: 198b820deec8fa0383daefa6d13f8055676860a032c7027961732f90645d707a70c45189929ebd8bb10b9fa26e8af8f7fca0c95028e6f2ec9ba1d860523d98cd
|
data/History.txt
CHANGED
@@ -16,3 +16,7 @@
|
|
16
16
|
blank strings should be wrapped in quotes so YAML parsers know to return a blank string
|
17
17
|
instead of a nil. Eg. foo: should parse as {"foo":nil} while foo: "" should parse as
|
18
18
|
{"foo":""}.
|
19
|
+
|
20
|
+
== 1.0.4
|
21
|
+
|
22
|
+
* Mapping values are now wrapped in double quotes by default
|
@@ -114,11 +114,15 @@ class YamlWriteStream
|
|
114
114
|
stack.last
|
115
115
|
end
|
116
116
|
|
117
|
-
def write_scalar(value)
|
117
|
+
def write_scalar(value, quote = false)
|
118
118
|
style = if value == ''
|
119
119
|
Psych::Nodes::Scalar::DOUBLE_QUOTED
|
120
120
|
else
|
121
|
-
|
121
|
+
if !quote || !value
|
122
|
+
Psych::Nodes::Scalar::ANY
|
123
|
+
else
|
124
|
+
Psych::Nodes::Scalar::DOUBLE_QUOTED
|
125
|
+
end
|
122
126
|
end
|
123
127
|
|
124
128
|
quoted = value == ''
|
@@ -149,7 +153,7 @@ class YamlWriteStream
|
|
149
153
|
|
150
154
|
def write_key_value(key, value)
|
151
155
|
write_scalar(key)
|
152
|
-
write_scalar(value)
|
156
|
+
write_scalar(value, true)
|
153
157
|
end
|
154
158
|
|
155
159
|
def close
|
@@ -51,13 +51,17 @@ class YamlWriteStream
|
|
51
51
|
|
52
52
|
protected
|
53
53
|
|
54
|
-
def write_scalar(value)
|
54
|
+
def write_scalar(value, quote = false)
|
55
55
|
@first = false
|
56
56
|
|
57
57
|
style = if value == ''
|
58
58
|
Psych::Nodes::Scalar::DOUBLE_QUOTED
|
59
59
|
else
|
60
|
-
|
60
|
+
if !quote || !value
|
61
|
+
Psych::Nodes::Scalar::ANY
|
62
|
+
else
|
63
|
+
Psych::Nodes::Scalar::DOUBLE_QUOTED
|
64
|
+
end
|
61
65
|
end
|
62
66
|
|
63
67
|
quoted = value == ''
|
@@ -84,7 +88,7 @@ class YamlWriteStream
|
|
84
88
|
def write_key_value(key, value)
|
85
89
|
@first = false
|
86
90
|
write_scalar(key)
|
87
|
-
write_scalar(value)
|
91
|
+
write_scalar(value, true)
|
88
92
|
end
|
89
93
|
end
|
90
94
|
|
data/spec/stateful_spec.rb
CHANGED
@@ -31,7 +31,7 @@ describe YamlWriteStream::YieldingWriter do
|
|
31
31
|
stream_writer.write_key_value('def', 'ghi')
|
32
32
|
stream_writer.close
|
33
33
|
|
34
|
-
expect(stream.string).to eq(utf8("- abc\n- def: ghi\n"))
|
34
|
+
expect(stream.string).to eq(utf8("- abc\n- def: ! \"ghi\"\n"))
|
35
35
|
expect(stream_writer).to be_closed
|
36
36
|
expect(stream).to be_closed
|
37
37
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: yaml-write-stream
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Cameron Dutro
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-02-22 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: An easy, streaming way to generate YAML.
|
14
14
|
email:
|
@@ -17,6 +17,10 @@ executables: []
|
|
17
17
|
extensions: []
|
18
18
|
extra_rdoc_files: []
|
19
19
|
files:
|
20
|
+
- Gemfile
|
21
|
+
- History.txt
|
22
|
+
- README.md
|
23
|
+
- Rakefile
|
20
24
|
- lib/yaml-write-stream.rb
|
21
25
|
- lib/yaml-write-stream/stateful.rb
|
22
26
|
- lib/yaml-write-stream/version.rb
|
@@ -26,33 +30,28 @@ files:
|
|
26
30
|
- spec/stateful_spec.rb
|
27
31
|
- spec/yaml-write-stream_spec.rb
|
28
32
|
- spec/yielding_spec.rb
|
29
|
-
- Gemfile
|
30
|
-
- History.txt
|
31
|
-
- README.md
|
32
|
-
- Rakefile
|
33
33
|
- yaml-write-stream.gemspec
|
34
34
|
homepage: http://github.com/camertron
|
35
35
|
licenses: []
|
36
36
|
metadata: {}
|
37
|
-
post_install_message:
|
37
|
+
post_install_message:
|
38
38
|
rdoc_options: []
|
39
39
|
require_paths:
|
40
40
|
- lib
|
41
41
|
required_ruby_version: !ruby/object:Gem::Requirement
|
42
42
|
requirements:
|
43
|
-
- -
|
43
|
+
- - ">="
|
44
44
|
- !ruby/object:Gem::Version
|
45
45
|
version: '0'
|
46
46
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
47
47
|
requirements:
|
48
|
-
- -
|
48
|
+
- - ">="
|
49
49
|
- !ruby/object:Gem::Version
|
50
50
|
version: '0'
|
51
51
|
requirements: []
|
52
|
-
rubyforge_project:
|
53
|
-
rubygems_version: 2.
|
54
|
-
signing_key:
|
52
|
+
rubyforge_project:
|
53
|
+
rubygems_version: 2.2.3
|
54
|
+
signing_key:
|
55
55
|
specification_version: 4
|
56
56
|
summary: An easy, streaming way to generate YAML.
|
57
57
|
test_files: []
|
58
|
-
has_rdoc: true
|