mirror of
https://github.com/dkam/decisiontree.git
synced 2025-12-27 22:54:52 +00:00
require graphr only when calling graph(), closes #11
This commit is contained in:
@@ -3,8 +3,6 @@
|
|||||||
### Copyright (c) 2007 Ilya Grigorik <ilya AT igvita DOT com>
|
### Copyright (c) 2007 Ilya Grigorik <ilya AT igvita DOT com>
|
||||||
### Modifed at 2007 by José Ignacio Fernández <joseignacio.fernandez AT gmail DOT com>
|
### Modifed at 2007 by José Ignacio Fernández <joseignacio.fernandez AT gmail DOT com>
|
||||||
|
|
||||||
require 'graphr'
|
|
||||||
|
|
||||||
class Object
|
class Object
|
||||||
def save_to_file(filename)
|
def save_to_file(filename)
|
||||||
File.open(filename, 'w+' ) { |f| f << Marshal.dump(self) }
|
File.open(filename, 'w+' ) { |f| f << Marshal.dump(self) }
|
||||||
@@ -133,6 +131,7 @@ module DecisionTree
|
|||||||
end
|
end
|
||||||
|
|
||||||
def graph(filename)
|
def graph(filename)
|
||||||
|
require 'graphr'
|
||||||
dgp = DotGraphPrinter.new(build_tree)
|
dgp = DotGraphPrinter.new(build_tree)
|
||||||
dgp.write_to_file("#{filename}.png", "png")
|
dgp.write_to_file("#{filename}.png", "png")
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user