ox 2.14.11 → 2.14.12

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a654851f11a761fdb77beb9cb4ec9ae07b4697cec9a4c5578a973a344779ca97
4
- data.tar.gz: b4b004cc4fd90e3c52e142bd4007c471515a520d52a42ca2d81f332c11e6b2ba
3
+ metadata.gz: bf4c5ff67edda493ebf9fd2a29fcee1584b0310f917094dec0a57eb93632f412
4
+ data.tar.gz: 7283aca3a2a2770f72696410a6691c131cfa2777562cd882f76bb0ea643c414e
5
5
  SHA512:
6
- metadata.gz: 6b0595691afa3021e1abada2fd0fc4fb21992a10155f744846b01eb40bd74e33bf52041db37ec502b3f916295b64bde60816c20d99ed9954633342d035225d8a
7
- data.tar.gz: e38010c8dcf091b983d17774464bd727a0f33538548d6b5d1820c6d043ba602d83552837a4ce4dd963c554ec19657475c21add9246323e5d5a9fbd7773c20e55
6
+ metadata.gz: e6ada04ac77531e74f5d40995d660d6e993d9c69685c586d15cbd9c896dfe6c60df879a51adecf5f5d3cb860b8bcb3fd80116a1001ae6eb5d15fbeb472be7118
7
+ data.tar.gz: 4053266ff36240627decb9eefbdc30e1afcb07bf36fed7ad639d2e1cfbff5165991f59ee1fdc985259f6dc60e4394e4782df98de9c73c2e51be911f39436d595
data/CHANGELOG.md CHANGED
@@ -2,6 +2,12 @@
2
2
 
3
3
  All changes to the Ox gem are documented here. Releases follow semantic versioning.
4
4
 
5
+ ## [2.14.12] - 2022-12-27
6
+
7
+ ### Fixed
8
+
9
+ - Updated to support Ruby 3.2.
10
+
5
11
  ## [2.14.11] - 2022-03-31
6
12
 
7
13
  ### Fixed
data/ext/ox/builder.c CHANGED
@@ -10,6 +10,7 @@
10
10
 
11
11
  #include "ruby.h"
12
12
  #include "ruby/encoding.h"
13
+ #include "ruby/version.h"
13
14
  #include "ox.h"
14
15
  #include "buf.h"
15
16
  #include "err.h"
@@ -881,6 +882,35 @@ builder_column(VALUE self) {
881
882
  return LONG2NUM(((Builder)DATA_PTR(self))->col);
882
883
  }
883
884
 
885
+ /* call-seq: indent()
886
+ *
887
+ * Returns the indentation level
888
+ */
889
+ static VALUE
890
+ builder_get_indent(VALUE self) {
891
+ return INT2NUM(((Builder)DATA_PTR(self))->indent);
892
+ }
893
+
894
+ /* call-seq: indent=(indent)
895
+ *
896
+ * Sets the indentation level
897
+ *
898
+ * - +indent+ (Fixnum) indentaion level, negative values excludes terminating newline
899
+ */
900
+ static VALUE
901
+ builder_set_indent(VALUE self, VALUE indent) {
902
+ #ifdef RUBY_INTEGER_UNIFICATION
903
+ if (rb_cInteger != rb_obj_class(indent)) {
904
+ #else
905
+ if (rb_cFixnum != rb_obj_class(indent)) {
906
+ #endif
907
+ rb_raise(ox_parse_error_class, "indent must be a fixnum.\n");
908
+ }
909
+
910
+ ((Builder)DATA_PTR(self))->indent = NUM2INT(indent);
911
+ return Qnil;
912
+ }
913
+
884
914
  /* call-seq: pos()
885
915
  *
886
916
  * Returns the number of bytes written.
@@ -923,6 +953,9 @@ ox_init_builder(VALUE ox) {
923
953
  ox = rb_define_module("Ox");
924
954
  #endif
925
955
  builder_class = rb_define_class_under(ox, "Builder", rb_cObject);
956
+ #if RUBY_API_VERSION_CODE >= 30200
957
+ rb_undef_alloc_func(builder_class);
958
+ #endif
926
959
  rb_define_module_function(builder_class, "new", builder_new, -1);
927
960
  rb_define_module_function(builder_class, "file", builder_file, -1);
928
961
  rb_define_module_function(builder_class, "io", builder_io, -1);
@@ -940,4 +973,6 @@ ox_init_builder(VALUE ox) {
940
973
  rb_define_method(builder_class, "line", builder_line, 0);
941
974
  rb_define_method(builder_class, "column", builder_column, 0);
942
975
  rb_define_method(builder_class, "pos", builder_pos, 0);
976
+ rb_define_method(builder_class, "indent", builder_get_indent, 0);
977
+ rb_define_method(builder_class, "indent=", builder_set_indent, 1);
943
978
  }
data/ext/ox/intern.c CHANGED
@@ -5,6 +5,8 @@
5
5
 
6
6
  #include <stdint.h>
7
7
 
8
+ #include "ruby/version.h"
9
+
8
10
  #include "cache.h"
9
11
  #include "ox.h"
10
12
 
@@ -68,6 +70,9 @@ static VALUE form_id(const char *str, size_t len) {
68
70
 
69
71
  void ox_hash_init() {
70
72
  VALUE cache_class = rb_define_class_under(Ox, "Cache", rb_cObject);
73
+ #if RUBY_API_VERSION_CODE >= 30200
74
+ rb_undef_alloc_func(cache_class);
75
+ #endif
71
76
 
72
77
  ox_str_cache = ox_cache_create(0, form_str, true, false);
73
78
  ox_str_cache_obj = Data_Wrap_Struct(cache_class, ox_cache_mark, ox_cache_free, ox_str_cache);
data/ext/ox/sax_as.c CHANGED
@@ -15,6 +15,7 @@
15
15
  #include <time.h>
16
16
 
17
17
  #include "ruby.h"
18
+ #include "ruby/version.h"
18
19
  #include "ox.h"
19
20
  #include "sax.h"
20
21
 
@@ -254,11 +255,16 @@ void
254
255
  ox_sax_define() {
255
256
  #if 0
256
257
  ox = rb_define_module("Ox");
258
+ #if RUBY_API_VERSION_CODE >= 30200
257
259
  sax_module = rb_define_class_under(ox, "Sax", rb_cObject);
260
+ #endif
258
261
  #endif
259
262
  VALUE sax_module = rb_const_get_at(Ox, rb_intern("Sax"));
260
263
 
261
264
  ox_sax_value_class = rb_define_class_under(sax_module, "Value", rb_cObject);
265
+ #if RUBY_API_VERSION_CODE >= 30200
266
+ rb_undef_alloc_func(ox_sax_value_class);
267
+ #endif
262
268
 
263
269
  rb_define_method(ox_sax_value_class, "as_s", sax_value_as_s, 0);
264
270
  rb_define_method(ox_sax_value_class, "as_sym", sax_value_as_sym, 0);
data/lib/ox/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
 
2
2
  module Ox
3
3
  # Current version of the module.
4
- VERSION = '2.14.11'
4
+ VERSION = '2.14.12'
5
5
  end
data/lib/ox.rb CHANGED
@@ -76,4 +76,9 @@ require 'ox/document'
76
76
  require 'ox/bag'
77
77
  require 'ox/sax'
78
78
 
79
- require 'ox/ox' # C extension
79
+ # C extension
80
+ begin
81
+ require_relative 'ox.so'
82
+ rescue LoadError
83
+ require 'ox/ox'
84
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ox
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.14.11
4
+ version: 2.14.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - Peter Ohler
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-03-31 00:00:00.000000000 Z
11
+ date: 2022-12-27 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: "A fast XML parser and object serializer that uses only standard C lib.\n\nOptimized
14
14
  XML (Ox), as the name implies was written to provide speed optimized\nXML handling.