Module: MobyUtil::XML::LibXML::Element
- Includes:
- Abstraction
- Defined in:
- lib/tdriver/util/xml/parsers/libxml/libxml.rb
Overview
Instance Method Summary
collapse
#empty?, #name, #nil?, #size, #to_s
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
in the class MobyUtil::XML::LibXML::Abstraction
Instance Method Details
#[](value) ⇒ Object
100
101
102
|
# File 'lib/tdriver/util/xml/parsers/libxml/libxml.rb', line 100
def []( value )
element_object( @xml[value] )
end
|
#attribute(attr_name) ⇒ Object
108
109
110
|
# File 'lib/tdriver/util/xml/parsers/libxml/libxml.rb', line 108
def attribute( attr_name )
@xml.attributes[ attr_name ].nil? ? nil : @xml.attributes[ attr_name ].to_s
end
|
#attributes ⇒ Object
112
113
114
|
# File 'lib/tdriver/util/xml/parsers/libxml/libxml.rb', line 112
def attributes
{}.tap{ | hash | @xml.attributes.each{ | attr | hash[attr.name.to_s] = attr.value.to_s } }
end
|
116
117
118
|
# File 'lib/tdriver/util/xml/parsers/libxml/libxml.rb', line 116
def content
@xml.content.to_s
end
|
#each(&block) ⇒ Object
104
105
106
|
# File 'lib/tdriver/util/xml/parsers/libxml/libxml.rb', line 104
def each( &block )
@xml.each{ | element | yield( element_object( element ) ) }
end
|
96
97
98
|
# File 'lib/tdriver/util/xml/parsers/libxml/libxml.rb', line 96
def first
self[0]
end
|
#inner_xml ⇒ Object
88
89
90
|
# File 'lib/tdriver/util/xml/parsers/libxml/libxml.rb', line 88
def inner_xml
@xml.inner_xml
end
|
#xpath(xpath_query) ⇒ Object
92
93
94
|
# File 'lib/tdriver/util/xml/parsers/libxml/libxml.rb', line 92
def xpath( xpath_query )
element_object( @xml.find( xpath_query ) )
end
|