Class: CooCoo::Dot::Graph

Inherits:
Block show all
Defined in:
lib/coo-coo/dot.rb

Defined Under Namespace

Classes: Edge, Node

Instance Attribute Summary collapse

Attributes inherited from Block

#kind, #options

Instance Method Summary collapse

Constructor Details

#initialize(kind, options) {|_self| ... } ⇒ Graph

Returns a new instance of Graph.

Yields:

  • (_self)

Yield Parameters:



41
42
43
44
45
46
47
# File 'lib/coo-coo/dot.rb', line 41

def initialize(kind, options)
  super(kind, options)
  @nodes = []
  @edges = []
  @blocks = []
  yield(self) if block_given?
end

Instance Attribute Details

#blocksObject (readonly)

Returns the value of attribute blocks.



39
40
41
# File 'lib/coo-coo/dot.rb', line 39

def blocks
  @blocks
end

#edgesObject (readonly)

Returns the value of attribute edges.



39
40
41
# File 'lib/coo-coo/dot.rb', line 39

def edges
  @edges
end

#nodesObject (readonly)

Returns the value of attribute nodes.



39
40
41
# File 'lib/coo-coo/dot.rb', line 39

def nodes
  @nodes
end

Instance Method Details

#add_block(type, options = {}, &block) ⇒ Object



64
65
66
67
# File 'lib/coo-coo/dot.rb', line 64

def add_block(type, options = {}, &block)
  @blocks << Graph.new(type, options, &block)
  self
end

#add_edge(nodes, options = {}) ⇒ Object



54
55
56
57
# File 'lib/coo-coo/dot.rb', line 54

def add_edge(nodes, options = {})
  @edges << Edge.new(nodes, options)
  self
end

#add_node(name, options = {}) ⇒ Object



49
50
51
52
# File 'lib/coo-coo/dot.rb', line 49

def add_node(name, options = {})
  @nodes << Node.new(name, options)
  self
end

#add_subgraph(name, options = {}, &block) ⇒ Object



59
60
61
62
# File 'lib/coo-coo/dot.rb', line 59

def add_subgraph(name, options = {}, &block)
  @blocks << Graph.new("subgraph #{name}", options, &block)
  self
end