Class: Johnson::Visitors::DotVisitor::Node

Inherits:
Struct
  • Object
show all
Defined in:
lib/johnson/visitors/dot_visitor.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#fieldsObject

Returns the value of attribute fields

Returns:

  • (Object)

    the current value of fields



8
9
10
# File 'lib/johnson/visitors/dot_visitor.rb', line 8

def fields
  @fields
end

#labelObject

Returns the value of attribute label

Returns:

  • (Object)

    the current value of label



8
9
10
# File 'lib/johnson/visitors/dot_visitor.rb', line 8

def label
  @label
end

#node_idObject

Returns the value of attribute node_id

Returns:

  • (Object)

    the current value of node_id



8
9
10
# File 'lib/johnson/visitors/dot_visitor.rb', line 8

def node_id
  @node_id
end

Instance Method Details

#to_sObject



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