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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: bd90ded7f462c2f4136c9dfbb4926efec78a3ea5
4
- data.tar.gz: cf6f2befaca3547e57d4a77daaac86e43f3e24be
3
+ metadata.gz: 80b1a8a4484b80539684a66a0c09c0f46d12731e
4
+ data.tar.gz: bad6594317352b11801ad99694454f004e5bc212
5
5
  SHA512:
6
- metadata.gz: ca73d35f31265535af40e942cd94ea452d5d31fc15b82a34d36094b5eba1ee18954403ae060514ef5d2486572dfa4752311c386b96fcee05e584384d506479d3
7
- data.tar.gz: 265247b81a1ada4bb4ac5e7bb85a8ae9c01eb94557a9cf1c3b9e08d7ec0d98b746a16af6196b09e413007cfc60a2d8da21d680bbfb40f129fcc87f0f7ec08cc5
6
+ metadata.gz: 2ff366500f44680fc0b90501ff6c73be2ada22a4d0f650924c1a5769bde1505b76c9bdb4c8b2c05889e9a1ac95e585e8b8857ccc6cb23b08bf81485ac7863567
7
+ data.tar.gz: b17c13f087c2dad87c708b9a5b1b609415f3121d07cd74643940a76cafb8b8ed8726dcec843ce4b65f8df09c6205140a6789e3ece934e2b47728c37602644383
@@ -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
- @prefix = $~[3]
44
- @comment = $~[5]
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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: yamlt
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.20
4
+ version: 0.0.21
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tangerine Cat