yeptris 0.6.3.1 → 0.6.3.2
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/yeptris/psych/visitors.rb +23 -0
- data/lib/yeptris.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 71f8626c8109cc1d84ee3593a0646a4005b22e00fad770426024fcd783ddf123
|
|
4
|
+
data.tar.gz: 34293da3ac105daa501ae1e7cc343294035341608696eb9f59bdea789e0cc4a8
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: c040550f2f2cfa3b30b1dfca891c306dd2ce390471457575be118098bc16718f48b6031d4c332b18f063556bbaad422135de220e924314291fae6c7438361461
|
|
7
|
+
data.tar.gz: 8cfc1cf59607134a53ea27dae7a5af0de6801ac251de429863f45ca899566b631638c70e7c4d863e9eb997df562fd3c9a6e2ac7d386bb01193efcbffeee6213d
|
|
@@ -32,11 +32,34 @@ module Yeptris
|
|
|
32
32
|
@tree.set_root(root) if root
|
|
33
33
|
self
|
|
34
34
|
end
|
|
35
|
+
alias_method :<<, :push # stdlib's dump body pushes via <<
|
|
36
|
+
|
|
37
|
+
# stdlib Psych.dump's tail: `visitor.tree.yaml io, options` —
|
|
38
|
+
# the tree wraps the built document; yaml serializes it
|
|
39
|
+
# (string return, or writes + returns the io)
|
|
40
|
+
def tree
|
|
41
|
+
BuiltDocument.new(@tree)
|
|
42
|
+
end
|
|
35
43
|
|
|
36
44
|
def finish
|
|
37
45
|
@tree.serialize(explicit_doc_start: true)
|
|
38
46
|
end
|
|
39
47
|
|
|
48
|
+
# The built-document handle stdlib's dump tail serializes
|
|
49
|
+
class BuiltDocument
|
|
50
|
+
def initialize(doc)
|
|
51
|
+
@doc = doc
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
def yaml(io = nil, _options = {})
|
|
55
|
+
out = @doc.serialize(explicit_doc_start: true)
|
|
56
|
+
return out unless io
|
|
57
|
+
|
|
58
|
+
io.write(out)
|
|
59
|
+
io
|
|
60
|
+
end
|
|
61
|
+
end
|
|
62
|
+
|
|
40
63
|
def visit(obj)
|
|
41
64
|
case obj
|
|
42
65
|
when nil, true, false, ::Integer, ::Float, ::String then scalar(obj)
|
data/lib/yeptris.rb
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
module Yeptris
|
|
4
4
|
# The gem's version lives in the parent namespace's file — the last
|
|
5
5
|
# internal require (yeptris/version) retired with it.
|
|
6
|
-
VERSION = "0.6.3.
|
|
6
|
+
VERSION = "0.6.3.2".freeze
|
|
7
7
|
# The error hierarchy lives in THIS file (the parent namespace's
|
|
8
8
|
# own file): nested constants do not trigger a parent-constant
|
|
9
9
|
# autoload, and the law forbids internal requires — defining the
|