Nokogiri::HTML::EntityLookup

class Nokogiri::HTML::EntityLookup

Parent:
Object

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
end
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–2016 Aaron Patterson, Mike Dalessio, Charles Nutter, Sergio Arbeo
Patrick Mahoney, Yoko Harada, Akinori Musha, John Shahid
Licensed under the MIT License.

在线笔记
App下载
App下载

扫描二维码

下载编程狮App

公众号
微信公众号

编程狮公众号

意见反馈
返回顶部