class Nokogiri::HTML::EntityLookup - nokogiri-1.6.3.1 Documentation

# class Nokogiri::HTML::EntityLookup

### Public Instance Methods

[](name) click to toggle source

Look up entity with `name`

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

get(key) click to toggle source

Get the HTML::EntityDescription for `key`

    static VALUE get(VALUE self, VALUE key)
    {
      const htmlEntityDesc * desc =
        htmlEntityLookup((const xmlChar *)StringValuePtr(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);
    }