class Nokogiri::HTML::EntityLookup


Public Instance Methods

[](name) Show source

Look up entity with name

# File lib/nokogiri/html/entity_lookup.rb, line 8
def [] name
  (val = get(name)) && val.value
get(key) Show source

Get the HTML::EntityDescription for key

static VALUE get(VALUE self, VALUE key)
  const htmlEntityDesc * desc =
    htmlEntityLookup((const xmlChar *)StringValueCStr(key));
  VALUE klass, args[3];

  if(NULL == desc) return Qnil;
  klass = rb_const_get(mNokogiriHtml, rb_intern("EntityDescription"));

  args[0] = INT2NUM((long)desc->value);
  args[1] = NOKOGIRI_STR_NEW2(desc->name);
  args[2] = NOKOGIRI_STR_NEW2(desc->desc);

  return rb_class_new_instance(3, args, klass);

© 2008–2017 Aaron Patterson, Mike Dalessio, Charles Nutter, Sergio Arbeo
Patrick Mahoney, Yoko Harada, Akinori Musha, John Shahid
Licensed under the MIT License.