/usr/share/doc/ruby-graphviz/examples/sample54.rb is in ruby-graphviz 1.0.8-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | $:.unshift( "../lib" )
require 'graphviz'
class Array
def rotate
## Solution #1 by greg
# self.push(r = self.shift)
# return r
## Solution #2 by madx
# shift.tap {|e| push e }
## Solution #3 by greg
push(shift)[-1]
end
end
type = ["box", "point"]
GraphViz.graph( :G, :use => :neato ) { |g|
(1..5).each do |x|
(1..5).each do |y|
g.add_nodes( "n#{x}x#{y}", :pos => "#{x},#{y}!", :shape => type.rotate )
end
end
}.output( :png => "#{$0}.png" )
|