Class: RPath::Adapters::REXML
- Inherits:
-
RPath::Adapter
- Object
- RPath::Adapter
- RPath::Adapters::REXML
- Defined in:
- lib/rpath/adapters/rexml.rb
Instance Method Summary collapse
-
#adapts?(graph) ⇒ Boolean
Returns
trueiffgraphis anREXML::Element. -
#adjacent(vertex) ⇒ Array<REXML::Element>
Returns the child elements of the given element.
-
#attribute(vertex, name) ⇒ String?
Returns the value of the named attribute on the given element.
-
#content(vertex) ⇒ String?
Returns the text content of the given element.
-
#name(vertex) ⇒ String
Returns the name of the given element.
Methods inherited from RPath::Adapter
Instance Method Details
#adapts?(graph) ⇒ Boolean
Returns true iff graph is an REXML::Element.
11 12 13 |
# File 'lib/rpath/adapters/rexml.rb', line 11 def adapts?(graph) graph.is_a? ::REXML::Element end |
#adjacent(vertex) ⇒ Array<REXML::Element>
Returns the child elements of the given element
25 26 27 |
# File 'lib/rpath/adapters/rexml.rb', line 25 def adjacent(vertex) vertex.elements.to_a end |
#attribute(vertex, name) ⇒ String?
Returns the value of the named attribute on the given element.
33 34 35 |
# File 'lib/rpath/adapters/rexml.rb', line 33 def attribute(vertex, name) vertex.attributes[name.to_s] end |
#content(vertex) ⇒ String?
Returns the text content of the given element.
40 41 42 |
# File 'lib/rpath/adapters/rexml.rb', line 40 def content(vertex) vertex.text end |
#name(vertex) ⇒ String
Returns the name of the given element
18 19 20 |
# File 'lib/rpath/adapters/rexml.rb', line 18 def name(vertex) vertex.name end |