Sha256: 9e460e62f1222df463bb4f008efc6e130c41410c859d3fd005fa8e39489d3e82

Contents?: true

Size: 573 Bytes

Versions: 1

Compression:

Stored size: 573 Bytes

Contents

#include <xml_text.h>

static void dealloc(xmlNodePtr node)
{
  if(node->doc == NULL) xmlFreeNode(node);
}

static VALUE new(VALUE klass, VALUE string)
{
  xmlNodePtr node = xmlNewText((xmlChar *)StringValuePtr(string));
  VALUE rb_node = Data_Wrap_Struct(klass, NULL, dealloc, node);
  node->_private = (void *)rb_node;

  if(rb_block_given_p()) rb_yield(rb_node);

  return rb_node;
}

VALUE cNokogiriXmlText ;
void init_xml_text()
{
  VALUE klass = cNokogiriXmlText = rb_const_get(mNokogiriXml, rb_intern("Text"));

  rb_define_singleton_method(klass, "new", new, 1);
}

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
tenderlove-nokogiri-0.0.0.20081001111445 ext/nokogiri/xml_text.c