Class: RGL::GraphXML::MutableGraphParser
- Inherits:
-
Object
- Object
- RGL::GraphXML::MutableGraphParser
- Includes:
- REXML::StreamListener
- Defined in:
- lib/rgl/graphxml.rb
Instance Attribute Summary collapse
-
#graph ⇒ Object
readonly
Returns the value of attribute graph.
Instance Method Summary collapse
-
#initialize(graph) ⇒ MutableGraphParser
constructor
A new instance of MutableGraphParser.
- #tag_start(name, attrs) ⇒ Object
Constructor Details
#initialize(graph) ⇒ MutableGraphParser
Returns a new instance of MutableGraphParser.
35 36 37 |
# File 'lib/rgl/graphxml.rb', line 35 def initialize (graph) @graph = graph end |
Instance Attribute Details
#graph ⇒ Object (readonly)
Returns the value of attribute graph.
33 34 35 |
# File 'lib/rgl/graphxml.rb', line 33 def graph @graph end |
Instance Method Details
#tag_start(name, attrs) ⇒ Object
39 40 41 42 43 44 45 46 |
# File 'lib/rgl/graphxml.rb', line 39 def tag_start (name, attrs) case name when 'edge' @graph.add_edge(attrs['source'], attrs['target']) when 'node' @graph.add_vertex(attrs['id']) end end |