libxml-ruby 3.2.0 → 3.2.3

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.
@@ -17,34 +17,36 @@ static void rxml_schema_type_free(xmlSchemaTypePtr xschema_type)
17
17
 
18
18
  VALUE rxml_wrap_schema_type(xmlSchemaTypePtr xtype)
19
19
  {
20
- return Data_Wrap_Struct(cXMLSchemaType, NULL, rxml_schema_type_free, xtype);
21
- }
20
+ VALUE result;
22
21
 
23
- static VALUE rxml_schema_type_namespace(VALUE self)
24
- {
25
- xmlSchemaTypePtr xtype;
22
+ if (!xtype)
23
+ rb_raise(rb_eArgError, "XML::Schema::Type required!");
26
24
 
27
- Data_Get_Struct(self, xmlSchemaType, xtype);
25
+ result = Data_Wrap_Struct(cXMLSchemaType, NULL, rxml_schema_type_free, xtype);
28
26
 
29
- QNIL_OR_STRING(xtype->targetNamespace)
27
+ rb_iv_set(result, "@name", QNIL_OR_STRING(xtype->name));
28
+ rb_iv_set(result, "@namespace", QNIL_OR_STRING(xtype->targetNamespace));
29
+ rb_iv_set(result, "@kind", INT2NUM(xtype->type));
30
+
31
+ return result;
30
32
  }
31
33
 
32
- static VALUE rxml_schema_type_name(VALUE self)
34
+ static VALUE rxml_schema_type_base(VALUE self)
33
35
  {
34
36
  xmlSchemaTypePtr xtype;
35
37
 
36
38
  Data_Get_Struct(self, xmlSchemaType, xtype);
37
39
 
38
- QNIL_OR_STRING(xtype->name)
40
+ return (xtype->baseType != xtype) ? rxml_wrap_schema_type(xtype->baseType) : Qnil;
39
41
  }
40
42
 
41
- static VALUE rxml_schema_type_base(VALUE self)
43
+ static VALUE rxml_schema_type_node(VALUE self)
42
44
  {
43
45
  xmlSchemaTypePtr xtype;
44
46
 
45
47
  Data_Get_Struct(self, xmlSchemaType, xtype);
46
48
 
47
- return Data_Wrap_Struct(cXMLSchemaType, NULL, rxml_schema_type_free, xtype->baseType);
49
+ return (xtype->node != NULL) ? rxml_node_wrap(xtype->node) : Qnil;
48
50
  }
49
51
 
50
52
  static VALUE rxml_schema_type_facets(VALUE self)
@@ -68,27 +70,6 @@ static VALUE rxml_schema_type_facets(VALUE self)
68
70
  return result;
69
71
  }
70
72
 
71
- static VALUE rxml_schema_type_node(VALUE self)
72
- {
73
- xmlSchemaTypePtr xtype;
74
-
75
- Data_Get_Struct(self, xmlSchemaType, xtype);
76
-
77
- if(xtype->node != NULL)
78
- return rxml_node_wrap(xtype->node);
79
- else
80
- return Qnil;
81
- }
82
-
83
- static VALUE rxml_schema_type_kind(VALUE self)
84
- {
85
- xmlSchemaTypePtr xtype;
86
-
87
- Data_Get_Struct(self, xmlSchemaType, xtype);
88
-
89
- return INT2NUM(xtype->type);
90
- }
91
-
92
73
  static VALUE rxml_schema_type_annot(VALUE self)
93
74
  {
94
75
  VALUE result = Qnil;
@@ -220,13 +201,14 @@ void rxml_init_schema_type(void)
220
201
 
221
202
  cXMLSchemaType = rb_define_class_under(cXMLSchema, "Type", rb_cObject);
222
203
 
223
- rb_define_method(cXMLSchemaType, "namespace", rxml_schema_type_namespace, 0);
224
- rb_define_method(cXMLSchemaType, "name", rxml_schema_type_name, 0);
225
- rb_define_method(cXMLSchemaType, "elements", rxml_schema_type_elements, 0);
226
- rb_define_method(cXMLSchemaType, "attributes", rxml_schema_type_attributes, 0);
204
+ rb_define_attr(cXMLSchemaType, "namespace", 1, 0);
205
+ rb_define_attr(cXMLSchemaType, "name", 1, 0);
206
+ rb_define_attr(cXMLSchemaType, "kind", 1, 0);
207
+
227
208
  rb_define_method(cXMLSchemaType, "base", rxml_schema_type_base, 0);
228
- rb_define_method(cXMLSchemaType, "kind", rxml_schema_type_kind, 0);
229
209
  rb_define_method(cXMLSchemaType, "node", rxml_schema_type_node, 0);
210
+ rb_define_method(cXMLSchemaType, "elements", rxml_schema_type_elements, 0);
211
+ rb_define_method(cXMLSchemaType, "attributes", rxml_schema_type_attributes, 0);
230
212
  rb_define_method(cXMLSchemaType, "facets", rxml_schema_type_facets, 0);
231
213
  rb_define_method(cXMLSchemaType, "annotation", rxml_schema_type_annot, 0);
232
214
  }
@@ -1,9 +1,9 @@
1
1
  /* Don't nuke this block! It is used for automatically updating the
2
2
  * versions below. VERSION = string formatting, VERNUM = numbered
3
3
  * version for inline testing: increment both or none at all.*/
4
- #define RUBY_LIBXML_VERSION "3.2.0"
5
- #define RUBY_LIBXML_VERNUM 320
4
+ #define RUBY_LIBXML_VERSION "3.2.3"
5
+ #define RUBY_LIBXML_VERNUM 323
6
6
  #define RUBY_LIBXML_VER_MAJ 3
7
7
  #define RUBY_LIBXML_VER_MIN 2
8
- #define RUBY_LIBXML_VER_MIC 0
8
+ #define RUBY_LIBXML_VER_MIC 3
9
9
  #define RUBY_LIBXML_VER_PATCH 0