yeptris 0.6.1.3-aarch64-linux → 0.6.2.2-aarch64-linux

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: 3e5b8193f2815d4e3d52870b429abcb0e8253aa8f0d9309f31927e72f77d4a5d
4
- data.tar.gz: f6e011eb746bc702ab53044c288dcfc28642b55d523394a957ff6e90e01cdb20
3
+ metadata.gz: 6588c765ddc8f4ea05e99c7305bd5d67fe3032c897ce25bfdeaedfbbccf06501
4
+ data.tar.gz: 12c9d8ace9c3e1e8ca7c4d338c3bdaae16132ea5e427ee6f25f9c1f439721c98
5
5
  SHA512:
6
- metadata.gz: 06eb30461b0a3a5bbf2024425c47e6fd9d313d073a62fe73d69dfa08cd97e5934e0f528bbd02df7ee0eba6af6359715ec67b9e378d8a4ad31f9b9342f613e3f0
7
- data.tar.gz: 625b12f9093edf683420ba81788c81e4e52a73ec5805184264c00aaafbee52461c16baba982871290e0f3d128c3e8f7cd1daeb67a3e6ac406cf791e65f6dbb4a
6
+ metadata.gz: 2b6329f89a4340c8fb24fd06f64d73ccb3bfcfa44d0f035ec3c1af9ab5294fd6c27865225110bc956b2f41ccf4924de4ba020384185d63970b9e01bb0ba4387b
7
+ data.tar.gz: 5382dccf761eacf9924937282999715d342d1b5531f4588828a7d6c680c99815df20284ccbccac39131d1fed3471501ff0b6cad077ce4a1178d30ca1d4750dd3
data/lib/yeptris/ffi.rb CHANGED
@@ -89,6 +89,8 @@ module Yeptris
89
89
  %i[yeptris_document pointer size_t int], :yeptris_node
90
90
  attach_function :yeptris_node_map_add,
91
91
  %i[yeptris_node pointer size_t yeptris_node], :int
92
+ attach_function :yeptris_node_map_add_node,
93
+ %i[yeptris_node yeptris_node yeptris_node], :int
92
94
  attach_function :yeptris_node_map_set,
93
95
  %i[yeptris_node pointer size_t yeptris_node], :int
94
96
  attach_function :yeptris_node_map_del, %i[yeptris_node pointer size_t], :int
@@ -176,6 +178,7 @@ module Yeptris
176
178
  BUILD_SEQ = 2
177
179
  BUILD_MAP = 3
178
180
  BUILD_END = 4
181
+ BUILD_TAG = 5
179
182
 
180
183
  # the ABI-pinned shape; the bulk builder packs these bytes
181
184
  # directly (12 per entry)
Binary file
data/lib/yeptris/node.rb CHANGED
@@ -201,6 +201,17 @@ class Yeptris::Node
201
201
  self
202
202
  end
203
203
 
204
+ # A pre-built key NODE ( Psych parity: nil keys ride the explicit
205
+ # `!` tag on an empty single-quoted scalar, which the byte-key form
206
+ # cannot carry)
207
+ def map_add_node(key_node, node)
208
+ rc = alive do
209
+ Yeptris::FFI.yeptris_node_map_add_node(@c_ptr, key_node.c_ptr, node.c_ptr)
210
+ end
211
+ Yeptris::FFI.check_status(rc, "yeptris_node_map_add_node")
212
+ self
213
+ end
214
+
204
215
  def map_set(key, node)
205
216
  key = key.to_s
206
217
  rc = alive { Yeptris::FFI.yeptris_node_map_set(@c_ptr, key, key.bytesize, node.c_ptr) }
@@ -12,6 +12,12 @@ module Yeptris
12
12
  # objects, aliases for repeats, the Encodable protocol, and the
13
13
  # !ruby/... tags Psych's own emitter produces.
14
14
  class YAMLTree
15
+ # stdlib's factory (relaton's db cache calls it): the options
16
+ # ride our visitor defaults
17
+ def self.create(options = {}, emitter = nil)
18
+ new
19
+ end
20
+
15
21
  def initialize
16
22
  @tree = ::Yeptris::Document.create
17
23
  @names = {} # object_id -> anchor name
@@ -114,14 +120,18 @@ module Yeptris
114
120
  # strings route through the builder's plain-safety helper
115
121
  # (one quoting rule, DRY); other scalars are their own text
116
122
  text =
117
- if obj.is_a?(::Date) || obj.is_a?(::Time)
118
- obj.iso8601 # canonical timestamp form, not to_s
123
+ if obj.is_a?(::Time)
124
+ # psych-5's format_time (#300 family 1) the FIRST cut
125
+ # put this branch after the Date||Time iso8601 one, dead
126
+ # code: Psych.dump of a Hash still emitted iso8601 (the
127
+ # neutral surface alone was pinned)
128
+ ::Yeptris::YAML::BulkBuilder.time_text(obj)
129
+ elsif obj.is_a?(::Date)
130
+ obj.iso8601 # canonical calendar form (DateTime rides here too)
119
131
  elsif obj.nil?
120
132
  "" # libyaml's null rendering rides bare (issue #290)
121
133
  elsif obj.is_a?(::Float)
122
134
  ::Yeptris::YAML::BulkBuilder.float_text(obj)
123
- elsif obj.is_a?(::Time)
124
- ::Yeptris::YAML::BulkBuilder.time_text(obj)
125
135
  else
126
136
  obj.to_s
127
137
  end
@@ -142,7 +152,17 @@ module Yeptris
142
152
  m = @tree.new_mapping
143
153
  remember(hash, m)
144
154
  m.set_anchor(name) if name
145
- hash.each { |k, v| m.map_add(key_text(k), visit(v)) }
155
+ hash.each do |k, v|
156
+ if k.nil?
157
+ # Psych's nil-key form: `! ''` — the explicit tag on an
158
+ # empty single-quoted key (#300 family 2)
159
+ key_node = @tree.new_scalar("", :single_quoted)
160
+ key_node.set_tag("!")
161
+ m.map_add_node(key_node, visit(v))
162
+ else
163
+ m.map_add(key_text(k), visit(v))
164
+ end
165
+ end
146
166
  m
147
167
  end
148
168
 
data/lib/yeptris/psych.rb CHANGED
@@ -184,7 +184,15 @@ module Yeptris
184
184
 
185
185
  # Arbitrary object graphs through the YAMLTree visitor
186
186
  # (anchors, !ruby/ tags); plain data rides the fast builder.
187
- def dump(obj, io = nil)
187
+ def dump(obj, io = nil, options = {})
188
+ # stdlib's Object#to_yaml calls Psych.dump(self, options) —
189
+ # the options hash lands in the io slot positionally; treat a
190
+ # Hash there as options (the options themselves ride the
191
+ # visitor's defaults, #95 thread)
192
+ if io.is_a?(::Hash)
193
+ options = io
194
+ io = nil
195
+ end
188
196
  # scalars take the fast builder; EVERYTHING else (including
189
197
  # plain containers — they may nest custom objects) goes
190
198
  # through the visitor, which builds the same DOM for plain
@@ -420,6 +428,20 @@ end
420
428
  # yeptris/psych/drop_in — process-exclusive by nature, since the
421
429
  # stdlib cannot be prevented from re-opening whatever ::Psych points
422
430
  # at once IT loads.
431
+ # The core extension (stdlib psych/core_ext parity): Object#to_yaml
432
+ # and Object.yaml_tag exist whether the consumer came through stdlib
433
+ # psych first or pure drop-in. Both definitions are compatible —
434
+ # whoever loads last wins, and both call the rebound Psych.dump.
435
+ class Object
436
+ def self.yaml_tag(url)
437
+ ::Yeptris::Psych.add_tag(url, self)
438
+ end
439
+
440
+ def to_yaml(options = {})
441
+ ::Yeptris::Psych.dump(self, options)
442
+ end
443
+ end
444
+
423
445
  # 0.4-contract migration signal (issue #95): this require used to
424
446
  # rebind ::Psych. It does not anymore, and re-binding it here would
425
447
  # regress #69 (any stdlib psych loaded afterwards would explode with
data/lib/yeptris/yaml.rb CHANGED
@@ -102,6 +102,7 @@ module Yeptris
102
102
  STYLE_SQ = 2
103
103
  STYLE_DQ = 3
104
104
  STYLE_LIT = 4
105
+ BUILD_TAG = Yeptris::FFI::BUILD_TAG
105
106
 
106
107
  module_function
107
108
 
@@ -164,8 +165,15 @@ module Yeptris
164
165
  # reader resolves them back to Symbols; Integer/Float/
165
166
  # bool keys ride plain like their values (Psych emits
166
167
  # 1: unquoted — #290 family 5); string keys ride the
167
- # visit_String rules like any other scalar
168
- if k.is_a?(Symbol)
168
+ # visit_String rules like any other scalar; NIL keys
169
+ # ride Psych's explicit-`!` empty-scalar form
170
+ # (#300 family 2)
171
+ if k.nil?
172
+ scalar("", STYLE_SQ, emit, blob, off)
173
+ emit.call(BUILD_TAG, 0, off[0], 1)
174
+ blob << "!"
175
+ off[0] += 1
176
+ elsif k.is_a?(Symbol)
169
177
  scalar(":#{k}", STYLE_PLAIN, emit, blob, off)
170
178
  elsif k.is_a?(String)
171
179
  place(k, emit, blob, off, seen)
@@ -316,7 +324,15 @@ module Yeptris
316
324
  def build_map(doc, h, seen)
317
325
  cycle_guard(h, seen) do
318
326
  m = doc.new_mapping
319
- h.each { |k, v| m.map_add(key_text(k), build(doc, v, seen)) }
327
+ h.each do |k, v|
328
+ if k.nil?
329
+ key_node = doc.new_scalar("", :single_quoted)
330
+ key_node.set_tag("!")
331
+ m.map_add_node(key_node, build(doc, v, seen))
332
+ else
333
+ m.map_add(key_text(k), build(doc, v, seen))
334
+ end
335
+ end
320
336
  m
321
337
  end
322
338
  end
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.1.3".freeze
6
+ VERSION = "0.6.2.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
data/libyeptris.so CHANGED
Binary file
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.1.3
4
+ version: 0.6.2.2
5
5
  platform: aarch64-linux
6
6
  authors:
7
7
  - Ribose Inc.