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
files.com-1.0.55 docs/vendor/bundle/ruby/2.5.0/gems/nokogiri-1.10.1/ext/nokogiri/xml_attribute_decl.c
nokogiri-1.11.0.rc2 ext/nokogiri/xml_attribute_decl.c
nokogiri-1.11.0.rc2-x86_64-linux ext/nokogiri/xml_attribute_decl.c
nokogiri-1.11.0.rc2-x86-mingw32 ext/nokogiri/xml_attribute_decl.c
nokogiri-1.11.0.rc2-x86-linux ext/nokogiri/xml_attribute_decl.c
nokogiri-1.11.0.rc2-x64-mingw32 ext/nokogiri/xml_attribute_decl.c
nokogiri-1.11.0.rc2-java ext/nokogiri/xml_attribute_decl.c
argon-1.3.1 vendor/bundle/ruby/2.7.0/gems/nokogiri-1.10.9/ext/nokogiri/xml_attribute_decl.c
symbolic_enum-1.1.5 vendor/bundle/ruby/2.7.0/gems/nokogiri-1.10.9/ext/nokogiri/xml_attribute_decl.c
nokogiri-1.10.9 ext/nokogiri/xml_attribute_decl.c
nokogiri-1.10.9-x86-mingw32 ext/nokogiri/xml_attribute_decl.c
nokogiri-1.10.9-x64-mingw32 ext/nokogiri/xml_attribute_decl.c
nokogiri-1.10.9-java ext/nokogiri/xml_attribute_decl.c
tdiary-5.1.1 vendor/bundle/ruby/2.7.0/gems/nokogiri-1.10.8/ext/nokogiri/xml_attribute_decl.c
tdiary-5.1.1 vendor/bundle/ruby/2.6.0/gems/nokogiri-1.10.5/ext/nokogiri/xml_attribute_decl.c
nokogiri-1.10.8 ext/nokogiri/xml_attribute_decl.c
nokogiri-1.10.8-x86-mingw32 ext/nokogiri/xml_attribute_decl.c
nokogiri-1.10.8-x64-mingw32 ext/nokogiri/xml_attribute_decl.c
nokogiri-1.10.8-java ext/nokogiri/xml_attribute_decl.c
nokogiri-1.11.0.rc1-x86_64-linux ext/nokogiri/xml_attribute_decl.c