Sha256: 55562fdf7858b6099e8e373c2502cb2cb2103fbf0e4341d002d108ea65b2c0c5
Contents?: true
Size: 1.38 KB
Versions: 16
Compression:
Stored size: 1.38 KB
Contents
#include <xml_attribute_decl.h> /* * call-seq: * attribute_type * * The attribute_type for this AttributeDecl */ static VALUE attribute_type(VALUE self) { xmlAttributePtr node; Data_Get_Struct(self, xmlAttribute, node); return INT2NUM((long)node->atype); } /* * call-seq: * default * * The default value */ static VALUE default_value(VALUE self) { xmlAttributePtr node; Data_Get_Struct(self, xmlAttribute, node); if(node->defaultValue) return NOKOGIRI_STR_NEW2(node->defaultValue); return Qnil; } /* * call-seq: * enumeration * * An enumeration of possible values */ static VALUE enumeration(VALUE self) { xmlAttributePtr node; Data_Get_Struct(self, xmlAttribute, node); VALUE list = rb_ary_new(); xmlEnumerationPtr enm = node->tree; while(enm) { rb_ary_push(list, NOKOGIRI_STR_NEW2(enm->name)); enm = enm->next; } return list; } VALUE cNokogiriXmlAttributeDecl; void init_xml_attribute_decl() { VALUE nokogiri = rb_define_module("Nokogiri"); VALUE xml = rb_define_module_under(nokogiri, "XML"); VALUE node = rb_define_class_under(xml, "Node", rb_cObject); VALUE klass = rb_define_class_under(xml, "AttributeDecl", node); cNokogiriXmlAttributeDecl = klass; rb_define_method(klass, "attribute_type", attribute_type, 0); rb_define_method(klass, "default", default_value, 0); rb_define_method(klass, "enumeration", enumeration, 0); }
Version data entries
16 entries across 16 versions & 6 rubygems