Class: GraphViz::Parser

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

Defined Under Namespace

Classes: Cluster, Context, Edge, EdgePreference, Graph, GraphPreference, NamedGraphPreference, Node, NodePreference, Options, Rank, Subgraph

Class Method Summary collapse

Class Method Details

.parse(file, *hOpts) {|graph| ... } ⇒ Object

Yields:

  • (graph)


238
239
240
241
242
243
244
245
246
247
# File 'lib/graphviz/parser.rb', line 238

def self.parse( file, *hOpts, &block )
  dot = open(file).read
  parser = DotParser.new()
  tree = parser.parse( dot )
  graph = tree.eval( GraphViz::Parser::Context.new(), hOpts )
  
  yield( graph ) if( block and graph.nil? == false )
  
  return graph
end