Class: Rex::Parser::GraphML::Element::Graph
- Inherits:
-
AttributeContainer
- Object
- AttributeContainer
- Rex::Parser::GraphML::Element::Graph
- Defined in:
- lib/rex/parser/graphml.rb
Overview
A graph element defines a collection of nodes and edges. See: graphml.graphdrawing.org/specification/xsd.html#element-graph
Constant Summary collapse
- ELEMENT_NAME =
'graph'.freeze
Instance Attribute Summary collapse
-
#edgedefault ⇒ Object
Returns the value of attribute edgedefault.
-
#edges ⇒ Object
Returns the value of attribute edges.
-
#id ⇒ Object
Returns the value of attribute id.
-
#nodes ⇒ Object
Returns the value of attribute nodes.
Attributes inherited from AttributeContainer
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(edgedefault, id: nil) ⇒ Graph
constructor
A new instance of Graph.
Constructor Details
#initialize(edgedefault, id: nil) ⇒ Graph
Returns a new instance of Graph.
234 235 236 237 238 239 240 241 |
# File 'lib/rex/parser/graphml.rb', line 234 def initialize(edgedefault, id: nil) @edgedefault = edgedefault @id = id @nodes = {} @edges = [] super() end |
Instance Attribute Details
#edgedefault ⇒ Object
Returns the value of attribute edgedefault.
257 258 259 |
# File 'lib/rex/parser/graphml.rb', line 257 def edgedefault @edgedefault end |
#edges ⇒ Object
Returns the value of attribute edges.
263 264 265 |
# File 'lib/rex/parser/graphml.rb', line 263 def edges @edges end |
#id ⇒ Object
Returns the value of attribute id.
260 261 262 |
# File 'lib/rex/parser/graphml.rb', line 260 def id @id end |
#nodes ⇒ Object
Returns the value of attribute nodes.
266 267 268 |
# File 'lib/rex/parser/graphml.rb', line 266 def nodes @nodes end |
Class Method Details
.from_xml_attributes(xml_attrs) ⇒ Object
243 244 245 246 247 248 249 250 251 252 253 |
# File 'lib/rex/parser/graphml.rb', line 243 def self.from_xml_attributes(xml_attrs) edgedefault = xml_attrs['edgedefault'] unless %w[directed undirected].include? edgedefault # see: http://graphml.graphdrawing.org/primer/graphml-primer.html section 2.3.1 raise Error::InvalidAttributeError.new('graph', 'edgedefault', missing: edgedefault.nil?) end edgedefault = edgedefault.to_sym new(edgedefault, id: xml_attrs['id']) end |