teptris 0.3.0.1 → 0.3.0.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: 9506bf99d8b33b75ad8c8dc47cbac39c2b59441787023600cf1ebeb15d976aed
4
- data.tar.gz: d7fc5575833dbef7fad96a651b6c9d8be339572805b972b952c026c777fca716
3
+ metadata.gz: 16869d7dc17dada9785490a4cc1268a02c36a4926a198b31f692021af453835a
4
+ data.tar.gz: 53a738130ff1d160c40f6e40fef79d41d4920f5188372ba626a1bf5090a83d74
5
5
  SHA512:
6
- metadata.gz: ff6341114d0864103d56e5378095c2125c7163132ddb52f231e165b2a828c4c70aa4dcb7768d529a633aa600edd75b32406da349976fed71405546179e6e5c66
7
- data.tar.gz: c31169b8c9b4b5ddb5fa7590b7e1b861222591c2b1f2583f27e95970575fc8034ac942298134637567503a8cb972f9abd262292721dc95d166b195c618da09aa
6
+ metadata.gz: 6c1fde58fa36cce4e57af73453ace01e0ddcb82c08f83d9e1d0be3d95038fe2046d5a686f539ab41f451cc7289c10d2376bf5b29452dd2208a877cbd85598cbf
7
+ data.tar.gz: 45b1747790ff1a16b5d26f688c15b2dd3a9b31d2c9772af0a2f82564ee42548a5647a525383e768295e90fa4a13b6adc90be5701c69c88c253efad575f85094d
@@ -438,7 +438,9 @@ static void build_value(teptris_builder *b, VALUE v) {
438
438
  }
439
439
  }
440
440
 
441
- static VALUE ext_dump(VALUE self, VALUE obj) {
441
+ static VALUE dump_with(VALUE obj,
442
+ teptris_status (*emit)(const teptris_document *,
443
+ char **, size_t *)) {
442
444
  if (!RB_TYPE_P(obj, T_HASH))
443
445
  rb_raise(rb_eArgError, "cannot dump %s (root must be a Hash)",
444
446
  rb_obj_classname(obj));
@@ -454,7 +456,7 @@ static VALUE ext_dump(VALUE self, VALUE obj) {
454
456
  }
455
457
  char *buf = NULL;
456
458
  size_t len = 0;
457
- st = teptris_document_emit(doc, &buf, &len);
459
+ st = emit(doc, &buf, &len);
458
460
  teptris_document_free(doc);
459
461
  teptris_builder_free(b); /* doc already transferred/freed */
460
462
  if (st != TEPTRIS_OK)
@@ -464,6 +466,17 @@ static VALUE ext_dump(VALUE self, VALUE obj) {
464
466
  return out;
465
467
  }
466
468
 
469
+ static VALUE ext_dump(VALUE self, VALUE obj) {
470
+ return dump_with(obj, teptris_document_emit);
471
+ }
472
+
473
+ /* Natural JSON (engine 0.3.0): real numbers, booleans, RFC 3339
474
+ * datetime strings — the mappings Teptris.dump_json_natural
475
+ * documents. Non-finite floats become null. */
476
+ static VALUE ext_dump_json_natural(VALUE self, VALUE obj) {
477
+ return dump_with(obj, teptris_document_emit_json_natural);
478
+ }
479
+
467
480
  /* ------------------------------------------------- plan-walk (teptris#46) */
468
481
 
469
482
  static void plan_free(void *p) { teptris_plan_free((teptris_plan *)p); }
@@ -1213,6 +1226,8 @@ void Init_teptris_ext(void) {
1213
1226
  rb_define_method(cLazyValue, "to_a", lazy_to, 0);
1214
1227
  rb_define_method(cLazyValue, "value", lazy_to, 0);
1215
1228
  rb_define_module_function(m, "dump", ext_dump, 1);
1229
+ rb_define_module_function(m, "dump_json_natural", ext_dump_json_natural,
1230
+ 1);
1216
1231
  rb_define_module_function(m, "engine_version", ext_version, 0);
1217
1232
  rb_define_module_function(m, "plan_build", ext_plan_build, 2);
1218
1233
  rb_define_module_function(m, "plan_emit", ext_plan_emit, 2);
data/lib/teptris/toml.rb CHANGED
@@ -150,6 +150,13 @@ module Teptris::TOML
150
150
  TeptrisExt.dump(obj)
151
151
  end
152
152
 
153
+ # Natural JSON (engine 0.3.0): real numbers, booleans, RFC 3339
154
+ # datetime strings. Non-finite floats become null — the same
155
+ # documented lossy mapping as teptris.h's natural-JSON contract.
156
+ def dump_json_natural(obj)
157
+ TeptrisExt.dump_json_natural(obj)
158
+ end
159
+
153
160
  private
154
161
 
155
162
  def _validate_batch!(input, safe_load, datetime_policy, kind: :strings)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Teptris
4
- VERSION = "0.3.0.1"
4
+ VERSION = "0.3.0.2"
5
5
  end
data/sig/teptris.rbs CHANGED
@@ -49,6 +49,8 @@ module Teptris
49
49
 
50
50
  def self.dump: (untyped obj) -> String
51
51
 
52
+ def self.dump_json_natural: (untyped obj) -> String
53
+
52
54
  def self.engine_version: () -> String
53
55
 
54
56
  def self._validate_batch!: (untyped input, untyped safe_load,
@@ -122,6 +124,8 @@ module TeptrisExt
122
124
 
123
125
  def self.dump: (untyped obj) -> String
124
126
 
127
+ def self.dump_json_natural: (untyped obj) -> String
128
+
125
129
  def self.engine_version: () -> String
126
130
 
127
131
  def self.plan_build: (Array[[String, Integer, Integer]] rows,
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: teptris
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0.1
4
+ version: 0.3.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - teptris contributors
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2026-10-07 00:00:00.000000000 Z
11
+ date: 2026-10-08 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: A native C extension over libteptris, a C99 TOML 1.1 parser/emitter.
14
14
  API shape mirrors the tomlib gem.