Class: GraphvizR::NodeGroup

Inherits:
Object
  • Object
show all
Defined in:
lib/graphviz_r.rb

Overview

this represent a group of nodes

Instance Method Summary collapse

Constructor Details

#initialize(nodes, opts) ⇒ NodeGroup

Returns a new instance of NodeGroup.



347
348
349
350
# File 'lib/graphviz_r.rb', line 347

def initialize(nodes, opts)
  @nodes = nodes
  @opts = opts
end

Instance Method Details

#to_dot(indent) ⇒ Object



352
353
354
355
356
# File 'lib/graphviz_r.rb', line 352

def to_dot(indent)
  options = @opts.to_a.map{|e| "#{e[0]} = #{e[1]};"}.join ' '
  nodes = @nodes.map{|e| "#{e.to_s};"}.join ' '
  "#{INDENT_UNIT * indent}{#{options} #{nodes}};\n"
end