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