class RPath::Adapters::REXML

Public Instance Methods

adapts?(graph) click to toggle source

Returns true iff graph is an REXML::Element. @param [Object] graph @return [Boolean]

# File lib/rpath/adapters/rexml.rb, line 11
def adapts?(graph)
  graph.is_a? ::REXML::Element
end
adjacent(vertex) click to toggle source

Returns the child elements of the given element @param [REXML::Element] vertex @return [Array<REXML::Element>]

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

Returns the value of the named attribute on the given element. @param [REXML::Element] vertex @param [String, Symbol] name @return [String, nil]

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

Returns the text content of the given element. @param [REXML::Element] vertex @return [String, nil]

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

Returns the name of the given element @param [REXML::Element] vertex @return [String]

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