Class: GraphViz::DSL
Instance Attribute Summary collapse
- 
  
    
      #graph  ⇒ Object 
    
    
  
  
  
  
    
    
  
  
  
  
  
  
    Returns the value of attribute graph. 
Instance Method Summary collapse
- 
  
    
      #e(*args)  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    Create edges. 
- 
  
    
      #initialize(name, options = {}, &block)  ⇒ DSL 
    
    
  
  
  
    constructor
  
  
  
  
  
  
  
    Create a new graph. 
- 
  
    
      #method_missing(sym, *args, &block)  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    :nodoc:. 
- 
  
    
      #n(name)  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    Add a new node. 
- 
  
    
      #output(options = {})  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    Generate output. 
- 
  
    
      #subgraph(name, &block)  ⇒ Object 
    
    
      (also: #cluster)
    
  
  
  
  
  
  
  
  
  
    Add a subgraph. 
Constructor Details
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(sym, *args, &block) ⇒ Object
:nodoc:
| 12 13 14 15 16 17 18 19 20 21 22 | # File 'lib/graphviz/dsl.rb', line 12 def method_missing(sym, *args, &block) #:nodoc: return @graph.get_graph(sym.to_s) unless @graph.get_graph(sym.to_s).nil? return @graph.get_node(sym.to_s) unless @graph.get_node(sym.to_s).nil? if(@graph.respond_to?(sym, true)) @graph.send(sym, *args) elsif(block) @graph.add_graph(GraphViz::DSL.new(sym, { :parent => @graph, :type => @graph.type }, &block).graph) else @graph.add_nodes(sym.to_s, *args) end end | 
Instance Attribute Details
Instance Method Details
#e(*args) ⇒ Object
Create edges
| 31 32 33 34 35 36 37 38 39 | # File 'lib/graphviz/dsl.rb', line 31 def e(*args) e = nil last = args.shift while current = args.shift e = @graph.add_edges(last, current) last = current end return e end | 
#n(name) ⇒ Object
Add a new node
| 25 26 27 28 | # File 'lib/graphviz/dsl.rb', line 25 def n(name) return @graph.get_node(name) unless @graph.get_node(name.to_s).nil? @graph.add_nodes(name) end | 
#output(options = {}) ⇒ Object
Generate output
| 48 49 50 | # File 'lib/graphviz/dsl.rb', line 48 def output( = {}) @graph.output() end |