class RPath::Adapters::Nokogiri

Public Instance Methods

adapts?(graph) click to toggle source

Returns true iff graph is a Nokogiri::XML::Node. @param [Object] graph @return [Boolean]

# File lib/rpath/adapters/nokogiri.rb, line 11
def adapts?(graph)
  graph.is_a? ::Nokogiri::XML::Node
end
adjacent(vertex) click to toggle source

Returns the child elements of the given node @param [Nokogiri::XML::Node] vertex @return [Array<Nokogiri::XML::Node>]

# File lib/rpath/adapters/nokogiri.rb, line 25
def adjacent(vertex)
  vertex.children.to_a
end
attribute(vertex, name) click to toggle source

Returns the value of the named attribute on the given node. @param [Nokogiri::XML::Node] vertex @param [String, Symbol] name @return [String, nil]

# File lib/rpath/adapters/nokogiri.rb, line 33
def attribute(vertex, name)
  vertex[name.to_s]
end
content(vertex) click to toggle source

Returns the text content of the given node. @param [Nokogiri::XML::Node] vertex @return [String, nil]

# File lib/rpath/adapters/nokogiri.rb, line 40
def content(vertex)
  vertex.text
end
name(vertex) click to toggle source

Returns the name of the given node @param [Nokogiri::XML::Node] vertex @return [String]

# File lib/rpath/adapters/nokogiri.rb, line 18
def name(vertex)
  vertex.name
end