yeptris 0.1.13.4 → 0.1.13.5
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/document.rb +15 -3
- data/lib/yeptris/node.rb +11 -1
- data/lib/yeptris/valueml.rb +7 -6
- data/lib/yeptris.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 8744775f68ae8190635be3b97490040db3827fb724371af2952812194ec14229
|
|
4
|
+
data.tar.gz: aab368d84369bbc50744cf7d9a3e3123d2879af148b62efcfa03d3ca375f5e2a
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 0ed1f2fb61e8ead155a42d10a73257e61093e44ce017265b82c1448efd15ced1345ba4c203c979766c57b044faee9482426090f5d44b8c5d41fca124261654ec
|
|
7
|
+
data.tar.gz: e69a85e349c2dfcceb7b0b6184ee80664c8f7d6bc17248af1852dd47a1acbf9551477d996a1fda1ac2a9f53f846dd60a29c48a6ccc9e62b048e61cc848e519a3
|
data/lib/yeptris/document.rb
CHANGED
|
@@ -8,9 +8,13 @@ class Yeptris::Document
|
|
|
8
8
|
# explicit free path and the finalizer both flip the same flag.
|
|
9
9
|
Freed = Struct.new(:state) # :alive | :freed
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
# The schema this document was parsed with (a parse property).
|
|
12
|
+
attr_reader :parse_schema
|
|
13
|
+
|
|
14
|
+
def initialize(c_ptr = nil, freed = Freed.new(:alive), parse_schema = :core_12)
|
|
12
15
|
@c_ptr = c_ptr
|
|
13
16
|
@freed = freed
|
|
17
|
+
@parse_schema = parse_schema
|
|
14
18
|
@readonly = false
|
|
15
19
|
# Strong wrapper cache keyed on the C node address: the same C node
|
|
16
20
|
# always yields the same Ruby object (identity for aliases/eql?),
|
|
@@ -37,7 +41,7 @@ class Yeptris::Document
|
|
|
37
41
|
raise Yeptris::ParseError,
|
|
38
42
|
"parse failed: #{Yeptris::FFI.last_error_message}"
|
|
39
43
|
end
|
|
40
|
-
|
|
44
|
+
wrap_schema(doc, schema)
|
|
41
45
|
end
|
|
42
46
|
|
|
43
47
|
def self.parse_json(json)
|
|
@@ -47,7 +51,7 @@ class Yeptris::Document
|
|
|
47
51
|
raise Yeptris::ParseError,
|
|
48
52
|
"json parse failed: #{Yeptris::FFI.last_error_message}" if doc.null?
|
|
49
53
|
|
|
50
|
-
|
|
54
|
+
wrap_schema(doc, :core_12) # strict JSON is core by construction
|
|
51
55
|
end
|
|
52
56
|
|
|
53
57
|
# An empty document for from-scratch construction (TODO.impl/11 p3).
|
|
@@ -63,6 +67,14 @@ class Yeptris::Document
|
|
|
63
67
|
new(c_ptr)
|
|
64
68
|
end
|
|
65
69
|
|
|
70
|
+
# The schema the document was parsed with (:core_12 / :compat_11) —
|
|
71
|
+
# host scalar policies (Psych's dot-required float) are conditioned
|
|
72
|
+
# on it. The parse constructors set the real one; plain wrap keeps
|
|
73
|
+
# the core_12 default (yeptris_parse's default).
|
|
74
|
+
def self.wrap_schema(c_ptr, schema)
|
|
75
|
+
new(c_ptr, Freed.new(:alive), schema)
|
|
76
|
+
end
|
|
77
|
+
|
|
66
78
|
def ensure_alive!
|
|
67
79
|
raise Yeptris::FreedError, "document is freed" if @freed.state == :freed
|
|
68
80
|
end
|
data/lib/yeptris/node.rb
CHANGED
|
@@ -328,7 +328,17 @@ class Yeptris::Node
|
|
|
328
328
|
when :null then nil
|
|
329
329
|
when :bool then to_bool
|
|
330
330
|
when :int then to_i
|
|
331
|
-
when :float
|
|
331
|
+
when :float
|
|
332
|
+
# Psych's dot-required float applies ONLY under compat_11; the
|
|
333
|
+
# core schema's regexp has an optional dot (spec 10.3.2), so
|
|
334
|
+
# core_12 exponent-only floats materialize as Floats
|
|
335
|
+
text = value.to_s
|
|
336
|
+
if @document.parse_schema == :compat_11 &&
|
|
337
|
+
!text.include?(".") && !text.include?(":") && !text.start_with?(".")
|
|
338
|
+
text
|
|
339
|
+
else
|
|
340
|
+
to_f
|
|
341
|
+
end
|
|
332
342
|
when :timestamp then ::Yeptris::Materializer.parse_timestamp(value)
|
|
333
343
|
else value
|
|
334
344
|
end
|
data/lib/yeptris/valueml.rb
CHANGED
|
@@ -49,7 +49,7 @@ module Yeptris
|
|
|
49
49
|
flat = vals.read_bytes(count * VALUE_SIZE).unpack(UNPACK * count)
|
|
50
50
|
arena_bytes = arena.read_bytes(alen_p.read_uint64)
|
|
51
51
|
arena_bytes.force_encoding(Encoding::UTF_8)
|
|
52
|
-
walk(flat, arena_bytes)
|
|
52
|
+
walk(flat, arena_bytes, schema == :compat_11)
|
|
53
53
|
ensure
|
|
54
54
|
FFI.yeptris_value_free(vals, arena)
|
|
55
55
|
end
|
|
@@ -81,7 +81,8 @@ module Yeptris
|
|
|
81
81
|
pays = cols[:payloads].read_bytes(n * 8).unpack("q<*")
|
|
82
82
|
arena_bytes = cols[:arena].read_bytes(cols[:arena_len])
|
|
83
83
|
arena_bytes.force_encoding(Encoding::UTF_8)
|
|
84
|
-
walk_columns(kinds, tags, ikeys, bools, offs, lens, pays, arena_bytes
|
|
84
|
+
walk_columns(kinds, tags, ikeys, bools, offs, lens, pays, arena_bytes,
|
|
85
|
+
schema == :compat_11)
|
|
85
86
|
ensure
|
|
86
87
|
FFI.yeptris_value_free_columns(cols)
|
|
87
88
|
end
|
|
@@ -130,7 +131,7 @@ module Yeptris
|
|
|
130
131
|
LEN = 5
|
|
131
132
|
P64 = 6
|
|
132
133
|
|
|
133
|
-
def walk(flat, arena)
|
|
134
|
+
def walk(flat, arena, compat = true)
|
|
134
135
|
docs = []
|
|
135
136
|
stack = []
|
|
136
137
|
anchors = {}
|
|
@@ -171,7 +172,7 @@ module Yeptris
|
|
|
171
172
|
# Psych's float grammar requires the dot (or an inf/nan
|
|
172
173
|
# word, or sexagesimal ':') — exponent-only forms are
|
|
173
174
|
# Strings even when the compat tag says FLOAT
|
|
174
|
-
v = if text.include?(".") || text.include?(":") || text.start_with?(".")
|
|
175
|
+
v = if !compat || text.include?(".") || text.include?(":") || text.start_with?(".")
|
|
175
176
|
[flat[i + P64]].pack("q<").unpack1("E")
|
|
176
177
|
else
|
|
177
178
|
text
|
|
@@ -248,7 +249,7 @@ module Yeptris
|
|
|
248
249
|
|
|
249
250
|
# The columnar twin of walk above (lockstep: same semantics, same
|
|
250
251
|
# order; fields come from tight per-kind arrays, stride 1).
|
|
251
|
-
def walk_columns(kinds, tags, ikeys, bools, offs, lens, pays, arena)
|
|
252
|
+
def walk_columns(kinds, tags, ikeys, bools, offs, lens, pays, arena, compat = true)
|
|
252
253
|
docs = []
|
|
253
254
|
stack = []
|
|
254
255
|
anchors = {}
|
|
@@ -331,7 +332,7 @@ module Yeptris
|
|
|
331
332
|
end
|
|
332
333
|
when V_FLOAT
|
|
333
334
|
text = arena.byteslice(offs[i], lens[i])
|
|
334
|
-
v = if text.include?(".") || text.include?(":") || text.start_with?(".")
|
|
335
|
+
v = if !compat || text.include?(".") || text.include?(":") || text.start_with?(".")
|
|
335
336
|
[pays[i]].pack("q<").unpack1("E")
|
|
336
337
|
else
|
|
337
338
|
text
|
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.1.13.
|
|
6
|
+
VERSION = "0.1.13.5".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,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: yeptris
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.13.
|
|
4
|
+
version: 0.1.13.5
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Ribose Inc.
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-09-
|
|
11
|
+
date: 2026-09-08 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: ffi
|