lib/graphviz/graphml.rb in ruby-graphviz-0.9.18 vs lib/graphviz/graphml.rb in ruby-graphviz-0.9.19
- old
+ new
@@ -33,11 +33,12 @@
GTYPE = {
'directed' => :digraph,
'undirected' => :graph
}
- def initialize( xFile )
- @xmlDoc = REXML::Document::new( File::new( xFile ) )
+ def initialize( file_or_str )
+ data = ((File.file?( file_or_str )) ? File::new(file_or_str) : file_or_str)
+ @xmlDoc = REXML::Document::new( data )
@attributs = {
:nodes => {},
:edges => {},
:graphs => {}
}
\ No newline at end of file