Class: CooCoo::Dot::Graph
Defined Under Namespace
Instance Attribute Summary collapse
-
#blocks ⇒ Object
readonly
Returns the value of attribute blocks.
-
#edges ⇒ Object
readonly
Returns the value of attribute edges.
-
#nodes ⇒ Object
readonly
Returns the value of attribute nodes.
Attributes inherited from Block
Instance Method Summary collapse
- #add_block(type, options = {}, &block) ⇒ Object
- #add_edge(nodes, options = {}) ⇒ Object
- #add_node(name, options = {}) ⇒ Object
- #add_subgraph(name, options = {}, &block) ⇒ Object
-
#initialize(kind, options) {|_self| ... } ⇒ Graph
constructor
A new instance of Graph.
Constructor Details
#initialize(kind, options) {|_self| ... } ⇒ Graph
Returns a new instance of Graph.
41 42 43 44 45 46 47 |
# File 'lib/coo-coo/dot.rb', line 41 def initialize(kind, ) super(kind, ) @nodes = [] @edges = [] @blocks = [] yield(self) if block_given? end |
Instance Attribute Details
#blocks ⇒ Object (readonly)
Returns the value of attribute blocks.
39 40 41 |
# File 'lib/coo-coo/dot.rb', line 39 def blocks @blocks end |
#edges ⇒ Object (readonly)
Returns the value of attribute edges.
39 40 41 |
# File 'lib/coo-coo/dot.rb', line 39 def edges @edges end |
#nodes ⇒ Object (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, = {}, &block) @blocks << Graph.new(type, , &block) self end |
#add_edge(nodes, options = {}) ⇒ Object
54 55 56 57 |
# File 'lib/coo-coo/dot.rb', line 54 def add_edge(nodes, = {}) @edges << Edge.new(nodes, ) self end |