Class: DotGraph

Inherits:
Struct show all
Defined in:
lib/rpdf2txt-rockit/graphviz_dot.rb,
lib/rpdf2txt-rockit/graphviz_dot.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#descriptionObject

Returns the value of attribute description

Returns:

  • (Object)

    the current value of description



52
53
54
# File 'lib/rpdf2txt-rockit/graphviz_dot.rb', line 52

def description
  @description
end

Instance Method Details

#write_to_file(filename) ⇒ Object



54
55
56
57
58
59
60
61
62
# File 'lib/rpdf2txt-rockit/graphviz_dot.rb', line 54

def write_to_file(filename)
  tmpfile = filename + rand(100000).inspect
  while test(?f, tmpfile)
    tmpfile = filename + rand(100000).inspect
  end
  File.open(tmpfile, "w") {|f| f.write description}
  system "dot -Tps -o #{filename} #{tmpfile}"
  File.delete(tmpfile)
end