def initialize( xGraphName, hOpts = {}, &block )
@filename = nil
@name = xGraphName.to_s
@format = @@format
@prog = @@prog
@path = @@path
@errors = @@errors
@extlibs = @@extlibs
@output = {}
@nothugly = false
@strict = false
@elements_order = GraphViz::Elements::new()
@oParentGraph = nil
@oGraphType = "digraph"
@hoNodes = Hash::new()
@loEdges = Array::new()
@hoGraphs = Hash::new()
@node = GraphViz::Attrs::new( self, "node", NODESATTRS )
@edge = GraphViz::Attrs::new( self, "edge", EDGESATTRS )
@graph = GraphViz::Attrs::new( self, "graph", GRAPHSATTRS )
hOpts.each do |xKey, xValue|
case xKey.to_s
when "output"
warn ":output option is deprecated, please use :<format> => :<file>"
if FORMATS.index( xValue.to_s ).nil? == true
raise ArgumentError, "output format '#{xValue}' invalid"
end
@format = xValue.to_s
when "use"
if PROGRAMS.index( xValue.to_s ).nil? == true
raise ArgumentError, "can't use '#{xValue}'"
end
@prog = xValue.to_s
when "file"
warn ":file option is deprecated, please use :<format> => :<file>"
@filename = xValue.to_s
when "parent"
@oParentGraph = xValue
when "type"
if GRAPHTYPE.index( xValue.to_s ).nil? == true
raise ArgumentError, "graph type '#{xValue}' unknow"
end
@oGraphType = xValue.to_s
when "path"
@path = xValue.split( "," ).map{ |x| x.strip }
when "strict"
@strict = (xValue ? true : false)
when "errors"
@errors = xValue
when "extlibs"
@extlibs = xValue.split( "," ).map{ |x| x.strip }
else
self[xKey.to_s] = xValue.to_s
end
end
yield( self ) if( block )
end