Sha256: 1d78ae9752fd4acbc5124891ad7a635d857d4ecb2e85657f5b247be69fc31e30

Contents?: true

Size: 1.39 KB

Versions: 593

Compression:

Stored size: 1.39 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;
  xmlEnumerationPtr enm;
  VALUE list;

  Data_Get_Struct(self, xmlAttribute, node);

  list = rb_ary_new();
  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

593 entries across 561 versions & 47 rubygems

Version Path
nokogiri-backport-1.11.0 ext/nokogiri/xml_attribute_decl.c
tdiary-5.1.6 vendor/bundle/ruby/2.7.0/gems/tdiary-5.1.5/vendor/bundle/ruby/3.0.0/gems/nokogiri-1.10.10/ext/nokogiri/xml_attribute_decl.c
tdiary-5.1.6 vendor/bundle/ruby/2.7.0/gems/tdiary-5.1.5/vendor/bundle/ruby/2.7.0/gems/nokogiri-1.11.1-x86_64-linux/ext/nokogiri/xml_attribute_decl.c
tdiary-5.1.6 vendor/bundle/ruby/2.7.0/gems/tdiary-5.1.5/vendor/bundle/ruby/3.0.0/gems/nokogiri-1.11.1-x86_64-linux/ext/nokogiri/xml_attribute_decl.c
tdiary-5.1.6 vendor/bundle/ruby/2.7.0/gems/tdiary-5.1.5/vendor/bundle/ruby/3.0.0/gems/tdiary-5.1.4/vendor/bundle/ruby/2.7.0/gems/nokogiri-1.10.10/ext/nokogiri/xml_attribute_decl.c
tdiary-5.1.5 vendor/bundle/ruby/2.7.0/gems/nokogiri-1.11.1-x86_64-linux/ext/nokogiri/xml_attribute_decl.c
tdiary-5.1.5 vendor/bundle/ruby/3.0.0/gems/nokogiri-1.10.10/ext/nokogiri/xml_attribute_decl.c
tdiary-5.1.5 vendor/bundle/ruby/3.0.0/gems/nokogiri-1.11.1-x86_64-linux/ext/nokogiri/xml_attribute_decl.c
tdiary-5.1.5 vendor/bundle/ruby/3.0.0/gems/tdiary-5.1.4/vendor/bundle/ruby/2.7.0/gems/nokogiri-1.10.10/ext/nokogiri/xml_attribute_decl.c
video_chat_get-0.1.9 vendor/bundle/ruby/2.5.0/gems/nokogiri-1.10.9/ext/nokogiri/xml_attribute_decl.c
nokogiri-1.11.1 ext/nokogiri/xml_attribute_decl.c
nokogiri-1.11.1-x86_64-linux ext/nokogiri/xml_attribute_decl.c
nokogiri-1.11.1-x86_64-darwin ext/nokogiri/xml_attribute_decl.c
nokogiri-1.11.1-x86-mingw32 ext/nokogiri/xml_attribute_decl.c
nokogiri-1.11.1-x86-linux ext/nokogiri/xml_attribute_decl.c
nokogiri-1.11.1-x64-mingw32 ext/nokogiri/xml_attribute_decl.c
nokogiri-1.11.1-java ext/nokogiri/xml_attribute_decl.c
nokogiri-1.11.1-arm64-darwin ext/nokogiri/xml_attribute_decl.c
nokogiri-1.11.0 ext/nokogiri/xml_attribute_decl.c
nokogiri-1.11.0-x86_64-linux ext/nokogiri/xml_attribute_decl.c