Class: Johnson::Visitors::DotVisitor::Node
- Inherits:
-
Struct
- Object
- Struct
- Johnson::Visitors::DotVisitor::Node
- Defined in:
- lib/johnson/visitors/dot_visitor.rb
Instance Attribute Summary collapse
-
#fields ⇒ Object
Returns the value of attribute fields.
-
#label ⇒ Object
Returns the value of attribute label.
-
#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
8 9 10 |
# File 'lib/johnson/visitors/dot_visitor.rb', line 8 def fields @fields end |
#label ⇒ Object
Returns the value of attribute label
8 9 10 |
# File 'lib/johnson/visitors/dot_visitor.rb', line 8 def label @label end |
#node_id ⇒ Object
Returns the value of attribute node_id
8 9 10 |
# File 'lib/johnson/visitors/dot_visitor.rb', line 8 def node_id @node_id end |
Instance Method Details
#to_s ⇒ Object
9 10 11 12 13 14 15 |
# File 'lib/johnson/visitors/dot_visitor.rb', line 9 def to_s f = fields.map { |field| field.to_s.gsub(ESCAPE, '\\\\\1').gsub(/[\r\n]/, ' ') }.join('\n') f = "\\n#{f}" if f.length > 0 "\"#{node_id}\" [ label = \"#{label}#{f}\" ];" end |