yamlt 0.0.20 → 0.0.21
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 +4 -4
- data/lib/yamlt/parser/line.rb +12 -5
- data/lib/yamlt/parser/line/serializer.rb +5 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 80b1a8a4484b80539684a66a0c09c0f46d12731e
|
4
|
+
data.tar.gz: bad6594317352b11801ad99694454f004e5bc212
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2ff366500f44680fc0b90501ff6c73be2ada22a4d0f650924c1a5769bde1505b76c9bdb4c8b2c05889e9a1ac95e585e8b8857ccc6cb23b08bf81485ac7863567
|
7
|
+
data.tar.gz: b17c13f087c2dad87c708b9a5b1b609415f3121d07cd74643940a76cafb8b8ed8726dcec843ce4b65f8df09c6205140a6789e3ece934e2b47728c37602644383
|
data/lib/yamlt/parser/line.rb
CHANGED
@@ -13,7 +13,7 @@ module Yamlt
|
|
13
13
|
parse
|
14
14
|
end
|
15
15
|
|
16
|
-
attr_reader :comment, :prefix, :fragment, :level, :multiline, :clean
|
16
|
+
attr_reader :comment, :prefix, :fragment, :level, :multiline, :clean, :anchor
|
17
17
|
attr_accessor :full_path, :value
|
18
18
|
|
19
19
|
def as_text(opts={})
|
@@ -36,12 +36,13 @@ module Yamlt
|
|
36
36
|
when /^\s*$/
|
37
37
|
@clean = true
|
38
38
|
when /^(\s*)#(.*)$/; @comment = $~[2]; @prefix = $~[1]
|
39
|
-
when /^(\s*)(\w+):(\s*)(#(.*))?$/
|
39
|
+
when /^(\s*)(\w+):(\s*&\S+)?(\s*)(#(.*))?$/
|
40
40
|
if $~[1].length % 2 == 0
|
41
41
|
@fragment = $~[2]
|
42
42
|
@level = $~[1].length / 2
|
43
|
-
@
|
44
|
-
@
|
43
|
+
@anchor = $~[3]
|
44
|
+
@prefix = $~[4]
|
45
|
+
@comment = $~[6]
|
45
46
|
end
|
46
47
|
when /^(\s*)(\w+):(\s*)([\'\"])(.*)\4/
|
47
48
|
if $~[1].length % 2 == 0
|
@@ -57,7 +58,13 @@ module Yamlt
|
|
57
58
|
@prefix = $~[3] || $~[4]
|
58
59
|
@multiline = true
|
59
60
|
end
|
60
|
-
|
61
|
+
when /^(\s*)(\<\<:(\s+\*\w+\s*))(#(.*))?$/
|
62
|
+
if $~[1].length % 2 == 0
|
63
|
+
@fragment = "<<"
|
64
|
+
@level = $~[1].length / 2
|
65
|
+
@anchor = $~[3]
|
66
|
+
@comment = $~[5]
|
67
|
+
end
|
61
68
|
when /^(\s*)(['"]?)(.*)\2\s*$/
|
62
69
|
if $~[1].length % 2 == 0
|
63
70
|
@level = $~[1].length / 2
|
@@ -10,6 +10,7 @@ module Yamlt
|
|
10
10
|
def to_s
|
11
11
|
[ level_string,
|
12
12
|
fragment_string,
|
13
|
+
anchor_string,
|
13
14
|
prefix_string,
|
14
15
|
value_string,
|
15
16
|
comment
|
@@ -34,6 +35,10 @@ module Yamlt
|
|
34
35
|
end.to_s
|
35
36
|
end
|
36
37
|
|
38
|
+
def anchor_string
|
39
|
+
@line.anchor.to_s
|
40
|
+
end
|
41
|
+
|
37
42
|
def fragment
|
38
43
|
@overrides[:fragment] || @line.fragment
|
39
44
|
end
|