ox 2.4.5 → 2.4.6
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of ox might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/README.md +6 -0
- data/ext/ox/dump.c +52 -19
- data/ext/ox/extconf.rb +1 -0
- data/ext/ox/obj_load.c +3 -3
- data/ext/ox/ox.c +54 -4
- data/ext/ox/ox.h +2 -0
- data/lib/ox/element.rb +0 -1
- data/lib/ox/instruct.rb +0 -1
- data/lib/ox/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6ce85e954842fdace95d3d258fd0ff548116b057
|
4
|
+
data.tar.gz: 9b2165b3c83121034f73ec319aacb5db8001d729
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5f5e42834c773acbf9e05f15b005dfcc5f1fb1e004db643b9b8519804b2861a53e104b7f1416ffdc50331d173961dd601ab35f0fb68a644ec4a301354ce3398d
|
7
|
+
data.tar.gz: ff413f408b7df041195b17746f72f851f7626fa157bd58bb30b113f9ddafc1a4912d80e4d889f90cd9970078c18f3f1c8103dc3789878bb4c35c1a1733ebb180
|
data/README.md
CHANGED
@@ -34,6 +34,12 @@ A fast XML parser and Object marshaller as a Ruby gem.
|
|
34
34
|
|
35
35
|
## Release Notes
|
36
36
|
|
37
|
+
### Release 2.4.6
|
38
|
+
|
39
|
+
- Ready for Ruby 2.4 thanks to SHIBATA Hiroshi, hsbt.
|
40
|
+
|
41
|
+
- Added margin option to dump.
|
42
|
+
|
37
43
|
### Release 2.4.5
|
38
44
|
|
39
45
|
- Thanks to GUI for fixing an infinite loop in Ox::Builder.
|
data/ext/ox/dump.c
CHANGED
@@ -158,6 +158,10 @@ inline static void
|
|
158
158
|
fill_indent(Out out, int cnt) {
|
159
159
|
if (0 <= cnt) {
|
160
160
|
*out->cur++ = '\n';
|
161
|
+
if (0 < out->opts->margin_len) {
|
162
|
+
memcpy(out->cur, out->opts->margin, out->opts->margin_len);
|
163
|
+
out->cur += out->opts->margin_len;
|
164
|
+
}
|
161
165
|
for (; 0 < cnt; cnt--) {
|
162
166
|
*out->cur++ = ' ';
|
163
167
|
}
|
@@ -244,7 +248,7 @@ grow(Out out, size_t len) {
|
|
244
248
|
|
245
249
|
static void
|
246
250
|
dump_start(Out out, Element e) {
|
247
|
-
size_t size = e->indent + 4;
|
251
|
+
size_t size = e->indent + 4 + out->opts->margin_len;
|
248
252
|
|
249
253
|
if (0 < e->attr.len) { /* a="attr" */
|
250
254
|
size += e->attr.len + 5;
|
@@ -258,7 +262,7 @@ dump_start(Out out, Element e) {
|
|
258
262
|
if (out->end - out->cur <= (long)size) {
|
259
263
|
grow(out, size);
|
260
264
|
}
|
261
|
-
if (out->buf < out->cur) {
|
265
|
+
if (out->buf + out->opts->margin_len < out->cur) {
|
262
266
|
fill_indent(out, e->indent);
|
263
267
|
}
|
264
268
|
*out->cur++ = '<';
|
@@ -285,7 +289,7 @@ dump_start(Out out, Element e) {
|
|
285
289
|
|
286
290
|
static void
|
287
291
|
dump_end(Out out, Element e) {
|
288
|
-
size_t size = e->indent + 5;
|
292
|
+
size_t size = e->indent + 5 + out->opts->margin_len;
|
289
293
|
|
290
294
|
if (out->end - out->cur <= (long)size) {
|
291
295
|
grow(out, size);
|
@@ -530,6 +534,9 @@ dump_first_obj(VALUE obj, Out out) {
|
|
530
534
|
int cnt;
|
531
535
|
|
532
536
|
if (Yes == copts->with_xml) {
|
537
|
+
if (0 < copts->margin_len) {
|
538
|
+
dump_value(out, copts->margin, copts->margin_len);
|
539
|
+
}
|
533
540
|
if ('\0' == *copts->encoding) {
|
534
541
|
dump_value(out, "<?xml version=\"1.0\"?>", 21);
|
535
542
|
} else {
|
@@ -538,16 +545,27 @@ dump_first_obj(VALUE obj, Out out) {
|
|
538
545
|
}
|
539
546
|
}
|
540
547
|
if (Yes == copts->with_instruct) {
|
541
|
-
|
542
|
-
|
548
|
+
if (out->buf < out->cur) {
|
549
|
+
dump_value(out, "\n", 1);
|
550
|
+
}
|
551
|
+
if (0 < copts->margin_len) {
|
552
|
+
dump_value(out, copts->margin, copts->margin_len);
|
553
|
+
}
|
554
|
+
cnt = snprintf(buf, sizeof(buf), "<?ox version=\"1.0\" mode=\"object\"%s%s?>",
|
543
555
|
(Yes == copts->circular) ? " circular=\"yes\"" : ((No == copts->circular) ? " circular=\"no\"" : ""),
|
544
556
|
(Yes == copts->xsd_date) ? " xsd_date=\"yes\"" : ((No == copts->xsd_date) ? " xsd_date=\"no\"" : ""));
|
545
557
|
dump_value(out, buf, cnt);
|
546
558
|
}
|
547
559
|
if (Yes == copts->with_dtd) {
|
560
|
+
if (0 < copts->margin_len) {
|
561
|
+
dump_value(out, copts->margin, copts->margin_len);
|
562
|
+
}
|
548
563
|
cnt = snprintf(buf, sizeof(buf), "%s<!DOCTYPE %c SYSTEM \"ox.dtd\">", (out->buf < out->cur) ? "\n" : "", obj_class_code(obj));
|
549
564
|
dump_value(out, buf, cnt);
|
550
565
|
}
|
566
|
+
if (0 < copts->margin_len) {
|
567
|
+
dump_value(out, copts->margin, copts->margin_len);
|
568
|
+
}
|
551
569
|
dump_obj(0, obj, 0, out);
|
552
570
|
}
|
553
571
|
|
@@ -568,7 +586,7 @@ dump_obj(ID aid, VALUE obj, int depth, Out out) {
|
|
568
586
|
} else {
|
569
587
|
e.attr.str = rb_id2name(aid);
|
570
588
|
// Ruby 2.3 started to return NULL for some IDs so check for
|
571
|
-
// NULL. Ignore
|
589
|
+
// NULL. Ignore if NULL aid.
|
572
590
|
if (NULL == e.attr.str) {
|
573
591
|
return;
|
574
592
|
}
|
@@ -772,9 +790,9 @@ dump_obj(ID aid, VALUE obj, int depth, Out out) {
|
|
772
790
|
}
|
773
791
|
clas = rb_obj_class(obj);
|
774
792
|
if (rb_cRange == clas) {
|
775
|
-
VALUE beg
|
776
|
-
VALUE end
|
777
|
-
VALUE excl =
|
793
|
+
VALUE beg = RSTRUCT_GET(obj, 0);
|
794
|
+
VALUE end = RSTRUCT_GET(obj, 1);
|
795
|
+
VALUE excl = RSTRUCT_GET(obj, 2);
|
778
796
|
int d2 = depth + 1;
|
779
797
|
|
780
798
|
e.type = RangeCode; e.clas.len = 5; e.clas.str = "Range";
|
@@ -785,17 +803,23 @@ dump_obj(ID aid, VALUE obj, int depth, Out out) {
|
|
785
803
|
out->w_end(out, &e);
|
786
804
|
} else {
|
787
805
|
char num_buf[16];
|
788
|
-
VALUE *vp;
|
789
|
-
int i;
|
790
806
|
int d2 = depth + 1;
|
807
|
+
#if UNIFY_FIXNUM_AND_BIGNUM
|
808
|
+
long i;
|
809
|
+
long cnt = NUM2LONG(RSTRUCT_LEN(obj));
|
810
|
+
#else // UNIFY_FIXNUM_AND_INTEGER
|
811
|
+
int i;
|
812
|
+
int cnt = (int)RSTRUCT_LEN(obj);
|
813
|
+
#endif // UNIFY_FIXNUM_AND_INTEGER
|
791
814
|
|
792
815
|
e.type = StructCode;
|
793
816
|
e.clas.str = rb_class2name(clas);
|
794
817
|
e.clas.len = strlen(e.clas.str);
|
795
818
|
out->w_start(out, &e);
|
796
|
-
|
797
|
-
for (i = 0
|
798
|
-
|
819
|
+
|
820
|
+
for (i = 0; i < cnt; i++) {
|
821
|
+
VALUE v = RSTRUCT_GET(obj, i);
|
822
|
+
dump_obj(rb_intern(ulong2str(i, num_buf + sizeof(num_buf) - 1)), v, d2, out);
|
799
823
|
}
|
800
824
|
out->w_end(out, &e);
|
801
825
|
}
|
@@ -994,6 +1018,9 @@ dump_gen_doc(VALUE obj, int depth, Out out) {
|
|
994
1018
|
}
|
995
1019
|
}
|
996
1020
|
if (Yes == out->opts->with_xml) {
|
1021
|
+
if (0 < out->opts->margin_len) {
|
1022
|
+
dump_value(out, out->opts->margin, out->opts->margin_len);
|
1023
|
+
}
|
997
1024
|
dump_value(out, "<?xml", 5);
|
998
1025
|
if (Qnil != attrs) {
|
999
1026
|
rb_hash_foreach(attrs, dump_gen_attr, (VALUE)out);
|
@@ -1002,10 +1029,12 @@ dump_gen_doc(VALUE obj, int depth, Out out) {
|
|
1002
1029
|
}
|
1003
1030
|
if (Yes == out->opts->with_instruct) {
|
1004
1031
|
if (out->buf < out->cur) {
|
1005
|
-
dump_value(out, "\n
|
1006
|
-
}
|
1007
|
-
|
1032
|
+
dump_value(out, "\n", 1);
|
1033
|
+
}
|
1034
|
+
if (0 < out->opts->margin_len) {
|
1035
|
+
dump_value(out, out->opts->margin, out->opts->margin_len);
|
1008
1036
|
}
|
1037
|
+
dump_value(out, "<?ox version=\"1.0\" mode=\"generic\"?>", 35);
|
1009
1038
|
}
|
1010
1039
|
if (Qnil != nodes) {
|
1011
1040
|
dump_gen_nodes(nodes, depth, out);
|
@@ -1029,10 +1058,14 @@ dump_gen_element(VALUE obj, int depth, Out out) {
|
|
1029
1058
|
} else {
|
1030
1059
|
indent = depth * out->indent;
|
1031
1060
|
}
|
1032
|
-
size = indent + 4 + nlen;
|
1061
|
+
size = indent + 4 + nlen + out->opts->margin_len;
|
1033
1062
|
if (out->end - out->cur <= (long)size) {
|
1034
1063
|
grow(out, size);
|
1035
1064
|
}
|
1065
|
+
if (0 == depth && 0 < out->opts->margin_len && 0 < out->indent) {
|
1066
|
+
memcpy(out->cur, out->opts->margin, out->opts->margin_len);
|
1067
|
+
out->cur += out->opts->margin_len;
|
1068
|
+
}
|
1036
1069
|
fill_indent(out, indent);
|
1037
1070
|
*out->cur++ = '<';
|
1038
1071
|
fill_value(out, name, nlen);
|
@@ -1195,7 +1228,7 @@ dump_gen_val_node(VALUE obj, int depth,
|
|
1195
1228
|
} else {
|
1196
1229
|
indent = depth * out->indent;
|
1197
1230
|
}
|
1198
|
-
size = indent + plen + slen + vlen;
|
1231
|
+
size = indent + plen + slen + vlen + out->opts->margin_len;
|
1199
1232
|
if (out->end - out->cur <= (long)size) {
|
1200
1233
|
grow(out, size);
|
1201
1234
|
}
|
data/ext/ox/extconf.rb
CHANGED
@@ -36,6 +36,7 @@ dflags = {
|
|
36
36
|
'HAS_TOP_LEVEL_ST_H' => ('ree' == type || ('ruby' == type && '1' == version[0] && '8' == version[1])) ? 1 : 0,
|
37
37
|
'NEEDS_UIO' => (RUBY_PLATFORM =~ /(win|w)32$/) ? 0 : 1,
|
38
38
|
'HAS_DATA_OBJECT_WRAP' => ('ruby' == type && '2' == version[0] && '3' <= version[1]) ? 1 : 0,
|
39
|
+
'UNIFY_FIXNUM_AND_BIGNUM' => ('ruby' == type && '2' == version[0] && '4' <= version[1]) ? 1 : 0,
|
39
40
|
}
|
40
41
|
|
41
42
|
if RUBY_PLATFORM =~ /(win|w)32$/ || RUBY_PLATFORM =~ /solaris2\.10/
|
data/ext/ox/obj_load.c
CHANGED
@@ -756,11 +756,11 @@ end_element(PInfo pi, const char *ename) {
|
|
756
756
|
case RangeCode:
|
757
757
|
#if HAS_RSTRUCT
|
758
758
|
if (ox_beg_id == h->var) {
|
759
|
-
|
759
|
+
RSTRUCT_SET(ph->obj, 0, h->obj);
|
760
760
|
} else if (ox_end_id == h->var) {
|
761
|
-
|
761
|
+
RSTRUCT_SET(ph->obj, 1, h->obj);
|
762
762
|
} else if (ox_excl_id == h->var) {
|
763
|
-
|
763
|
+
RSTRUCT_SET(ph->obj, 2, h->obj);
|
764
764
|
} else {
|
765
765
|
set_error(&pi->err, "Invalid range attribute", pi->str, pi->s);
|
766
766
|
return;
|
data/ext/ox/ox.c
CHANGED
@@ -118,6 +118,7 @@ static VALUE generic_sym;
|
|
118
118
|
static VALUE inactive_sym;
|
119
119
|
static VALUE invalid_replace_sym;
|
120
120
|
static VALUE limited_sym;
|
121
|
+
static VALUE margin_sym;
|
121
122
|
static VALUE mode_sym;
|
122
123
|
static VALUE object_sym;
|
123
124
|
static VALUE off_sym;
|
@@ -153,8 +154,10 @@ void *ox_utf8_encoding = 0;
|
|
153
154
|
|
154
155
|
struct _Options ox_default_options = {
|
155
156
|
{ '\0' }, /* encoding */
|
157
|
+
{ '\0' }, /* margin */
|
156
158
|
2, /* indent */
|
157
159
|
0, /* trace */
|
160
|
+
0, /* margin_len */
|
158
161
|
No, /* with_dtd */
|
159
162
|
No, /* with_xml */
|
160
163
|
No, /* with_instruct */
|
@@ -257,6 +260,7 @@ hints_to_overlay(Hints hints) {
|
|
257
260
|
/* call-seq: default_options() => Hash
|
258
261
|
*
|
259
262
|
* Returns the default load and dump options as a Hash. The options are
|
263
|
+
* - _:margin_ [String] left margin to inset when dumping
|
260
264
|
* - _:indent_ [Fixnum] number of spaces to indent each element in an XML document
|
261
265
|
* - _:trace_ [Fixnum] trace level where 0 is silent
|
262
266
|
* - _:encoding_ [String] character encoding for the XML file
|
@@ -291,6 +295,7 @@ get_def_opts(VALUE self) {
|
|
291
295
|
int elen = (int)strlen(ox_default_options.encoding);
|
292
296
|
|
293
297
|
rb_hash_aset(opts, ox_encoding_sym, (0 == elen) ? Qnil : rb_str_new(ox_default_options.encoding, elen));
|
298
|
+
rb_hash_aset(opts, margin_sym, rb_str_new(ox_default_options.margin, ox_default_options.margin_len));
|
294
299
|
rb_hash_aset(opts, ox_indent_sym, INT2FIX(ox_default_options.indent));
|
295
300
|
rb_hash_aset(opts, trace_sym, INT2FIX(ox_default_options.trace));
|
296
301
|
rb_hash_aset(opts, with_dtd_sym, (Yes == ox_default_options.with_dtd) ? Qtrue : ((No == ox_default_options.with_dtd) ? Qfalse : Qnil));
|
@@ -384,6 +389,7 @@ sax_html_overlay(VALUE self) {
|
|
384
389
|
*
|
385
390
|
* Sets the default options for load and dump.
|
386
391
|
* - +opts+ [Hash] opts options to change
|
392
|
+
* - _:margin_ [String] left margin to inset when dumping
|
387
393
|
* - _:indent_ [Fixnum] number of spaces to indent each element in an XML document
|
388
394
|
* - _:trace_ [Fixnum] trace level where 0 is silent
|
389
395
|
* - _:encoding_ [String] character encoding for the XML file
|
@@ -509,7 +515,7 @@ set_def_opts(VALUE self, VALUE opts) {
|
|
509
515
|
|
510
516
|
Check_Type(v, T_STRING);
|
511
517
|
slen = RSTRING_LEN(v);
|
512
|
-
if (sizeof(ox_default_options.inv_repl) - 2 <
|
518
|
+
if (sizeof(ox_default_options.inv_repl) - 2 < (size_t)slen) {
|
513
519
|
rb_raise(ox_parse_error_class, ":invalid_replace can be no longer than %ld characters.",
|
514
520
|
sizeof(ox_default_options.inv_repl) - 2);
|
515
521
|
}
|
@@ -530,7 +536,7 @@ set_def_opts(VALUE self, VALUE opts) {
|
|
530
536
|
|
531
537
|
Check_Type(v, T_STRING);
|
532
538
|
slen = RSTRING_LEN(v);
|
533
|
-
if (sizeof(ox_default_options.strip_ns) - 1 <
|
539
|
+
if (sizeof(ox_default_options.strip_ns) - 1 < (size_t)slen) {
|
534
540
|
rb_raise(ox_parse_error_class, ":strip_namespace can be no longer than %ld characters.",
|
535
541
|
sizeof(ox_default_options.strip_ns) - 1);
|
536
542
|
}
|
@@ -538,6 +544,21 @@ set_def_opts(VALUE self, VALUE opts) {
|
|
538
544
|
ox_default_options.strip_ns[sizeof(ox_default_options.strip_ns) - 1] = '\0';
|
539
545
|
}
|
540
546
|
|
547
|
+
v = rb_hash_aref(opts, margin_sym);
|
548
|
+
if (Qnil != v) {
|
549
|
+
long slen;
|
550
|
+
|
551
|
+
Check_Type(v, T_STRING);
|
552
|
+
slen = RSTRING_LEN(v);
|
553
|
+
if (sizeof(ox_default_options.margin) - 1 < (size_t)slen) {
|
554
|
+
rb_raise(ox_parse_error_class, ":margin can be no longer than %ld characters.",
|
555
|
+
sizeof(ox_default_options.margin) - 1);
|
556
|
+
}
|
557
|
+
strncpy(ox_default_options.margin, StringValuePtr(v), sizeof(ox_default_options.margin) - 1);
|
558
|
+
ox_default_options.margin[sizeof(ox_default_options.margin) - 1] = '\0';
|
559
|
+
ox_default_options.margin_len = strlen(ox_default_options.margin);
|
560
|
+
}
|
561
|
+
|
541
562
|
for (o = ynos; 0 != o->attr; o++) {
|
542
563
|
v = rb_hash_lookup(opts, o->sym);
|
543
564
|
if (Qnil == v) {
|
@@ -720,7 +741,7 @@ load(char *xml, int argc, VALUE *argv, VALUE self, VALUE encoding, Err err) {
|
|
720
741
|
|
721
742
|
Check_Type(v, T_STRING);
|
722
743
|
slen = RSTRING_LEN(v);
|
723
|
-
if (sizeof(options.inv_repl) - 2 <
|
744
|
+
if (sizeof(options.inv_repl) - 2 < (size_t)slen) {
|
724
745
|
rb_raise(ox_parse_error_class, ":invalid_replace can be no longer than %ld characters.",
|
725
746
|
sizeof(options.inv_repl) - 2);
|
726
747
|
}
|
@@ -740,13 +761,27 @@ load(char *xml, int argc, VALUE *argv, VALUE self, VALUE encoding, Err err) {
|
|
740
761
|
|
741
762
|
Check_Type(v, T_STRING);
|
742
763
|
slen = RSTRING_LEN(v);
|
743
|
-
if (sizeof(options.strip_ns) - 1 <
|
764
|
+
if (sizeof(options.strip_ns) - 1 < (size_t)slen) {
|
744
765
|
rb_raise(ox_parse_error_class, ":strip_namespace can be no longer than %ld characters.",
|
745
766
|
sizeof(options.strip_ns) - 1);
|
746
767
|
}
|
747
768
|
strncpy(options.strip_ns, StringValuePtr(v), sizeof(options.strip_ns) - 1);
|
748
769
|
options.strip_ns[sizeof(options.strip_ns) - 1] = '\0';
|
749
770
|
}
|
771
|
+
v = rb_hash_lookup(h, margin_sym);
|
772
|
+
if (Qnil != v) {
|
773
|
+
long slen;
|
774
|
+
|
775
|
+
Check_Type(v, T_STRING);
|
776
|
+
slen = RSTRING_LEN(v);
|
777
|
+
if (sizeof(options.margin) - 1 < (size_t)slen) {
|
778
|
+
rb_raise(ox_parse_error_class, ":margin can be no longer than %ld characters.",
|
779
|
+
sizeof(options.margin) - 1);
|
780
|
+
}
|
781
|
+
strncpy(options.margin, StringValuePtr(v), sizeof(options.margin) - 1);
|
782
|
+
options.margin[sizeof(options.margin) - 1] = '\0';
|
783
|
+
options.margin_len = strlen(options.margin);
|
784
|
+
}
|
750
785
|
}
|
751
786
|
#if HAS_ENCODING_SUPPORT
|
752
787
|
if ('\0' == *options.encoding) {
|
@@ -1140,6 +1175,20 @@ parse_dump_options(VALUE ropts, Options copts) {
|
|
1140
1175
|
*copts->inv_repl = (char)slen;
|
1141
1176
|
copts->allow_invalid = No;
|
1142
1177
|
}
|
1178
|
+
v = rb_hash_lookup(ropts, margin_sym);
|
1179
|
+
if (Qnil != v) {
|
1180
|
+
long slen;
|
1181
|
+
|
1182
|
+
Check_Type(v, T_STRING);
|
1183
|
+
slen = RSTRING_LEN(v);
|
1184
|
+
if (sizeof(copts->margin) - 2 < (size_t)slen) {
|
1185
|
+
rb_raise(ox_parse_error_class, ":margin can be no longer than %ld characters.",
|
1186
|
+
sizeof(copts->margin) - 2);
|
1187
|
+
}
|
1188
|
+
strncpy(copts->margin, StringValuePtr(v), sizeof(copts->margin) - 1);
|
1189
|
+
copts->margin[sizeof(copts->margin) - 1] = '\0';
|
1190
|
+
copts->margin_len = (char)slen;
|
1191
|
+
}
|
1143
1192
|
|
1144
1193
|
for (o = ynos; 0 != o->attr; o++) {
|
1145
1194
|
if (Qnil != (v = rb_hash_lookup(ropts, o->sym))) {
|
@@ -1376,6 +1425,7 @@ void Init_ox() {
|
|
1376
1425
|
smart_sym = ID2SYM(rb_intern("smart")); rb_gc_register_address(&smart_sym);
|
1377
1426
|
strict_sym = ID2SYM(rb_intern("strict")); rb_gc_register_address(&strict_sym);
|
1378
1427
|
strip_namespace_sym = ID2SYM(rb_intern("strip_namespace")); rb_gc_register_address(&strip_namespace_sym);
|
1428
|
+
margin_sym = ID2SYM(rb_intern("margin")); rb_gc_register_address(&margin_sym);
|
1379
1429
|
symbolize_keys_sym = ID2SYM(rb_intern("symbolize_keys")); rb_gc_register_address(&symbolize_keys_sym);
|
1380
1430
|
symbolize_sym = ID2SYM(rb_intern("symbolize")); rb_gc_register_address(&symbolize_sym);
|
1381
1431
|
tolerant_sym = ID2SYM(rb_intern("tolerant")); rb_gc_register_address(&tolerant_sym);
|
data/ext/ox/ox.h
CHANGED
@@ -120,8 +120,10 @@ typedef struct _CircArray {
|
|
120
120
|
|
121
121
|
typedef struct _Options {
|
122
122
|
char encoding[64]; /* encoding, stored in the option to avoid GC invalidation in default values */
|
123
|
+
char margin[128]; /* left margin for dumping */
|
123
124
|
int indent; /* indention for dump, default 2 */
|
124
125
|
int trace; /* trace level */
|
126
|
+
char margin_len; /* margin length */
|
125
127
|
char with_dtd; /* YesNo */
|
126
128
|
char with_xml; /* YesNo */
|
127
129
|
char with_instruct; /* YesNo */
|
data/lib/ox/element.rb
CHANGED
@@ -68,7 +68,6 @@ module Ox
|
|
68
68
|
# - +other+ [Object] Object compare _self_ to.
|
69
69
|
# *return* [Boolean] true if both Objects are equivalent, otherwise false.
|
70
70
|
def eql?(other)
|
71
|
-
return false if (other.nil? or self.class != other.class)
|
72
71
|
return false unless super(other)
|
73
72
|
return false unless self.attributes == other.attributes
|
74
73
|
return false unless self.nodes == other.nodes
|
data/lib/ox/instruct.rb
CHANGED
@@ -25,7 +25,6 @@ module Ox
|
|
25
25
|
# - +other+ [Object] Object compare _self_ to.
|
26
26
|
# *return* [Boolean] true if both Objects are equivalent, otherwise false.
|
27
27
|
def eql?(other)
|
28
|
-
return false if (other.nil? or self.class != other.class)
|
29
28
|
return false unless super(other)
|
30
29
|
return false unless self.attributes == other.attributes
|
31
30
|
return false unless self.content == other.content
|
data/lib/ox/version.rb
CHANGED
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.4.
|
4
|
+
version: 2.4.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Peter Ohler
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-11-28 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
|
14
14
|
\ \nOptimized XML (Ox), as the name implies was written to provide speed
|
@@ -97,7 +97,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
97
97
|
version: '0'
|
98
98
|
requirements: []
|
99
99
|
rubyforge_project: ox
|
100
|
-
rubygems_version: 2.
|
100
|
+
rubygems_version: 2.5.1
|
101
101
|
signing_key:
|
102
102
|
specification_version: 4
|
103
103
|
summary: A fast XML parser and object serializer.
|