yeptris 0.6.2.2 → 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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c7cbac43219b4ebaa9e50dd2e31f952e04e147f61a2b31da36607ecdd6ec6353
4
- data.tar.gz: 1776b7da27e9e9a3686eadd95cc36d18b961ccb536a070a50ddb4f78e22e972a
3
+ metadata.gz: 71f8626c8109cc1d84ee3593a0646a4005b22e00fad770426024fcd783ddf123
4
+ data.tar.gz: 34293da3ac105daa501ae1e7cc343294035341608696eb9f59bdea789e0cc4a8
5
5
  SHA512:
6
- metadata.gz: 320f371c5a058d59954f78b71f1735fc4d0c085034a6685fc7b9f903694dc1528a6fb754fd98fa93ff5ae848fa9d91ad3c6272e115dc9d3c1390fe3efc517221
7
- data.tar.gz: cdae458f8fa79763c28c30ec3c2d1479c57180147af0b5171fe20ff415fd2f723218ba984c016185781983de2c1a5e39421039a2127855c6a7ab54d8dd4e3f27
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.2.2".freeze
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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: yeptris
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.2.2
4
+ version: 0.6.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.