class LibXML::XML::Attr
Public Instance Methods
child? → (true|false)
click to toggle source
Returns whether this attribute has child attributes.
# File lib/libxml/attr.rb, line 12 def child? not self.children.nil? end
doc? → (true|false)
click to toggle source
Determine whether this attribute is associated with an XML::Document.
# File lib/libxml/attr.rb, line 21 def doc? not self.doc.nil? end
each_sibling(&blk)
click to toggle source
# File lib/libxml/attr.rb, line 96 def each_sibling(&blk) siblings(self,&blk) end
last? → (true|false)
click to toggle source
Determine whether this is the last attribute.
# File lib/libxml/attr.rb, line 29 def last? self.last.nil? end
namespacess → XML::Namespaces
click to toggle source
Returns this node's XML::Namespaces object, which is used to access the namespaces associated with this node.
# File lib/libxml/attr.rb, line 56 def namespaces @namespaces ||= XML::Namespaces.new(self) end
next? → (true|false)
click to toggle source
Determine whether there is a next attribute.
# File lib/libxml/attr.rb, line 37 def next? not self.next.nil? end
node_type_name()
click to toggle source
Returns this node's type name
# File lib/libxml/attr.rb, line 78 def node_type_name if node_type == Node::ATTRIBUTE_NODE 'attribute' else raise(UnknownType, "Unknown node type: %n", node.node_type); end end
ns? → (true|false)
click to toggle source
Determine whether this attribute has an associated namespace.
# File lib/libxml/attr.rb, line 46 def ns? not self.ns.nil? end
parent? → (true|false)
click to toggle source
Determine whether this attribute has a parent.
# File lib/libxml/attr.rb, line 65 def parent? not self.parent.nil? end
prev? → (true|false)
click to toggle source
Determine whether there is a previous attribute.
# File lib/libxml/attr.rb, line 73 def prev? not self.prev.nil? end
siblings(node, &blk)
click to toggle source
Iterates nodes and attributes
# File lib/libxml/attr.rb, line 87 def siblings(node, &blk) if n = node loop do blk.call(n) break unless n = n.next end end end
to_a()
click to toggle source
# File lib/libxml/attr.rb, line 110 def to_a inject([]) do |ary,a| ary << [a.name, a.value] ary end end
to_h()
click to toggle source
# File lib/libxml/attr.rb, line 103 def to_h inject({}) do |h,a| h[a.name] = a.value h end end
to_s()
click to toggle source
# File lib/libxml/attr.rb, line 117 def to_s "#{name} = #{value}" end