Sha256: ad25de06fdba59d6aed880eb44330f9ee416c26e95d16b02b22ab6bef5e9eddd
Contents?: true
Size: 504 Bytes
Versions: 13
Compression:
Stored size: 504 Bytes
Contents
$:.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_node( "n#{x}x#{y}", :pos => "#{x},#{y}!", :shape => type.rotate ) end end }.output( :png => "#{$0}.png" )
Version data entries
13 entries across 13 versions & 1 rubygems