Class: Nokogiri::HTML::EntityLookup
- Inherits:
-
Object
- Object
- Nokogiri::HTML::EntityLookup
- Defined in:
- lib/nokogiri/html/entity_lookup.rb,
ext/nokogiri/html_entity_lookup.c
Instance Method Summary collapse
-
#[](name) ⇒ Object
Look up entity with
name
. -
#get(key) ⇒ Object
Get the HTML::EntityDescription for
key
.
Instance Method Details
#[](name) ⇒ Object
Look up entity with name
9 10 11 |
# File 'lib/nokogiri/html/entity_lookup.rb', line 9 def [] name (val = get(name)) && val.value end |
#get(key) ⇒ Object
Get the HTML::EntityDescription for key
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'ext/nokogiri/html_entity_lookup.c', line 9
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);
}
|