Class: Makiri::Attr

Inherits:
Node
  • Object
show all
Defined in:
lib/makiri/attr.rb,
ext/makiri/makiri.c

Overview

An attribute node. Most of the API lives in C (#name, #value).

An attribute knows its owning element through the document’s lazily-built attr->owner index, exposed as both #parent and #element.

Direct Known Subclasses

HTML::Attr, XML::Attr

Instance Method Summary collapse

Methods inherited from Node

#add_class, #append_class, #at, #attribute, #attribute?, #attributes, #blank?, #cdata?, #classes, #clone, #comment?, #document?, #document_fragment?, #dup, #each, #element?, #inspect, #path, #processing_instruction?, #remove_class, #root, #search, #set_attribute, #text?, #to_h, #traverse

Instance Method Details

#elementMakiri::Element?

The element this attribute belongs to, or nil if detached. Defined as a method (not an alias) so it resolves #parent dynamically on the per-kind leaf, where the reader actually lives.

Returns:



13
14
15
# File 'lib/makiri/attr.rb', line 13

def element
  parent
end