Class: RKelly::Visitors::DotVisitor::Node
- Inherits:
-
Struct
- Object
- Struct
- RKelly::Visitors::DotVisitor::Node
- Defined in:
- lib/rkelly/visitors/dot_visitor.rb
Constant Summary collapse
- ESCAPE =
/([<>"\\])/
Instance Attribute Summary collapse
-
#fields ⇒ Object
Returns the value of attribute fields.
-
#node_id ⇒ Object
Returns the value of attribute node_id.
Instance Method Summary collapse
Instance Attribute Details
#fields ⇒ Object
Returns the value of attribute fields
4 5 6 |
# File 'lib/rkelly/visitors/dot_visitor.rb', line 4 def fields @fields end |
#node_id ⇒ Object
Returns the value of attribute node_id
4 5 6 |
# File 'lib/rkelly/visitors/dot_visitor.rb', line 4 def node_id @node_id end |
Instance Method Details
#to_s ⇒ Object
6 7 8 9 10 11 12 13 14 |
# File 'lib/rkelly/visitors/dot_visitor.rb', line 6 def to_s counter = 0 label = fields.map { |f| s = "<f#{counter}> #{f.to_s.gsub(ESCAPE, '\\\\\1').gsub(/[\r\n]/,' ')}" counter += 1 s }.join('|') "\"#{node_id}\" [\nlabel = \"#{label}\"\nshape = \"record\"\n];" end |