ruby-graphviz 0.9.8 → 0.9.9

Sign up to get free protection for your applications and to get access to all the features.
data/ChangeLog.rdoc CHANGED
@@ -1,3 +1,8 @@
1
+ 0.9.9 :
2
+ * Add graph as an accessor to allow you to set global graph attributs (like edge and node)
3
+ * Add each_node, each_edge, each_graph (thanks to @metellius) and graph_count
4
+ * Issue #9 (partial) - Solution : by default, a node will have his label set with the node ID)
5
+
1
6
  0.9.8 :
2
7
  * Update graph and node posibility to set properties (see sample28.rb)
3
8
  * Issue #7: Path option is never being used to find the executable
@@ -65,6 +65,10 @@
65
65
  @ruby sample29.rb
66
66
  @echo "sample30.rb"
67
67
  @ruby sample30.rb
68
+ @echo "sample31.rb"
69
+ @ruby sample31.rb
70
+ @echo "sample32.rb"
71
+ @ruby sample32.rb
68
72
 
69
73
 
70
74
  @echo "shapes.rb"
data/examples/maketest.sh CHANGED
@@ -67,6 +67,10 @@ echo "sample29.rb"
67
67
  ruby sample29.rb
68
68
  echo "sample30.rb"
69
69
  ruby sample30.rb
70
+ echo "sample31.rb"
71
+ ruby sample31.rb
72
+ echo "sample32.rb"
73
+ ruby sample32.rb
70
74
 
71
75
  echo "shapes.rb"
72
76
  ruby shapes.rb
@@ -0,0 +1,125 @@
1
+ %! Greg shapes for GraphViz/DOT
2
+
3
+ % input format :
4
+ % [ 54 36 0 36 0 0 54 0 54 36 ] 4 false yourshape
5
+ % or
6
+ % [ 54 36 0 36 0 0 54 0 54 36 ] 4 true yourshape
7
+ % [ 150 150 100 150 100 100 150 100 150 150 ] 4 true yourshape
8
+ %
9
+ % [upper right (y, x), lower right (y, x), lower left (y, x), upper left (y, x), upper right (y, x)]
10
+
11
+ /xdef {exch def} bind def
12
+
13
+ /rgv_box {
14
+ 10 dict begin
15
+ /fflag xdef
16
+ /sides xdef
17
+
18
+ 4 sides ne { stop } if
19
+
20
+ aload pop
21
+
22
+ newpath
23
+ moveto
24
+ lineto
25
+ lineto
26
+ lineto
27
+ closepath
28
+
29
+ pop pop
30
+
31
+ fflag { fill } { stroke } ifelse
32
+ end
33
+ } bind def
34
+
35
+ /rgv_cloud {
36
+ 10 dict begin
37
+ /fflag xdef
38
+ /sides xdef
39
+
40
+ % Check if we have 4 sides. Else stop
41
+ 4 sides ne { stop } if
42
+
43
+ % (aload) takes an array as its argument and places the individual elements
44
+ % of that array, and then the array itself, on the stack. Then (pop) remove
45
+ % the top element from the stack (the array)
46
+ aload pop
47
+
48
+ /ury xdef /urx xdef
49
+ /lry xdef /lrx xdef
50
+ /lly xdef /llx xdef
51
+ /uly xdef /ulx xdef
52
+ pop pop
53
+
54
+ /mx lrx llx neg add 2 div def
55
+ /my uly lly neg add 2 div def
56
+
57
+ % empty the current path and declares we are starting a new path
58
+ newpath
59
+
60
+ urx ury my neg add my 270 90 arc
61
+ ulx mx add uly mx 0 180 arc
62
+ llx lly my add my 90 270 arc
63
+ lrx lry lineto
64
+
65
+ closepath
66
+
67
+ % The stroke operator on line four causes the path we have constructed to be
68
+ % painted onto the current page.
69
+ % The fill operator fills the current path with ink.
70
+ fflag { fill } { stroke } ifelse
71
+ end
72
+ } bind def
73
+
74
+ /rgv_flower {
75
+ 10 dict begin
76
+ /fflag xdef
77
+ /sides xdef
78
+
79
+ % Check if we have 4 sides. Else stop
80
+ 4 sides ne { stop } if
81
+
82
+ % (aload) takes an array as its argument and places the individual elements
83
+ % of that array, and then the array itself, on the stack. Then (pop) remove
84
+ % the top element from the stack (the array)
85
+ aload pop
86
+
87
+ /ury xdef /urx xdef
88
+ /lry xdef /lrx xdef
89
+ /lly xdef /llx xdef
90
+ /uly xdef /ulx xdef
91
+ pop pop
92
+
93
+ /mx lrx llx neg add 2 div def
94
+ /my uly lly neg add 2 div def
95
+
96
+ % empty the current path and declares we are starting a new path
97
+ newpath
98
+
99
+ % Arcs
100
+ urx ury my neg add my 270 90 arc
101
+ ulx mx add uly mx 0 180 arc
102
+ llx lly my add my 90 270 arc
103
+ lrx mx neg add lry mx 180 0 arc
104
+
105
+ closepath
106
+
107
+ % The stroke operator on line four causes the path we have constructed to be
108
+ % painted onto the current page.
109
+ % The fill operator fills the current path with ink.
110
+ fflag { fill } { stroke } ifelse
111
+ end
112
+ } bind def
113
+
114
+ %[ 150 150 50 150 50 100 150 100 150 150 ] 4 false rgv_box
115
+ %[ 250 250 150 250 150 200 250 200 250 250 ] 4 false rgv_flower
116
+ %[ 350 350 250 350 250 300 350 300 350 350 ] 4 false rgv_cloud
117
+ %
118
+ %.5 setgray
119
+ %[ 150 450 50 450 50 400 150 400 150 450 ] 4 true rgv_box
120
+ %.5 setgray
121
+ %[ 250 550 150 550 150 500 250 500 250 550 ] 4 true rgv_flower
122
+ %.5 setgray
123
+ %[ 350 650 250 650 250 600 350 600 350 650 ] 4 true rgv_cloud
124
+ %
125
+ %showpage
@@ -0,0 +1,12 @@
1
+ #!/usr/bin/ruby
2
+
3
+ $:.unshift( "../../lib" );
4
+ require "graphviz"
5
+
6
+ GraphViz.new(:g){ |g|
7
+ g[:center] = true
8
+ a = g.add_node("A", :shape => "rgv_box", :peripheries => 0)
9
+ b = g.add_node("Bonjour le monde\nComment va tu ?", :shape => "rgv_cloud", :peripheries => 0)
10
+ c = g.add_node("C", :shape => "rgv_flower", :peripheries => 0)
11
+ a << b << c
12
+ }.save( :ps => "#{$0}.ps", :extlib => "rgv.ps" )
@@ -0,0 +1,393 @@
1
+ %!PS-Adobe-3.0
2
+ %%Creator: graphviz version 2.26.0 (20091210.2329)
3
+ %%Title: g
4
+ %%Pages: (atend)
5
+ %%BoundingBox: (atend)
6
+ %%EndComments
7
+ save
8
+ %%BeginProlog
9
+ /DotDict 200 dict def
10
+ DotDict begin
11
+
12
+ /setupLatin1 {
13
+ mark
14
+ /EncodingVector 256 array def
15
+ EncodingVector 0
16
+
17
+ ISOLatin1Encoding 0 255 getinterval putinterval
18
+ EncodingVector 45 /hyphen put
19
+
20
+ % Set up ISO Latin 1 character encoding
21
+ /starnetISO {
22
+ dup dup findfont dup length dict begin
23
+ { 1 index /FID ne { def }{ pop pop } ifelse
24
+ } forall
25
+ /Encoding EncodingVector def
26
+ currentdict end definefont
27
+ } def
28
+ /Times-Roman starnetISO def
29
+ /Times-Italic starnetISO def
30
+ /Times-Bold starnetISO def
31
+ /Times-BoldItalic starnetISO def
32
+ /Helvetica starnetISO def
33
+ /Helvetica-Oblique starnetISO def
34
+ /Helvetica-Bold starnetISO def
35
+ /Helvetica-BoldOblique starnetISO def
36
+ /Courier starnetISO def
37
+ /Courier-Oblique starnetISO def
38
+ /Courier-Bold starnetISO def
39
+ /Courier-BoldOblique starnetISO def
40
+ cleartomark
41
+ } bind def
42
+
43
+ %%BeginResource: procset graphviz 0 0
44
+ /coord-font-family /Times-Roman def
45
+ /default-font-family /Times-Roman def
46
+ /coordfont coord-font-family findfont 8 scalefont def
47
+
48
+ /InvScaleFactor 1.0 def
49
+ /set_scale {
50
+ dup 1 exch div /InvScaleFactor exch def
51
+ scale
52
+ } bind def
53
+
54
+ % styles
55
+ /solid { [] 0 setdash } bind def
56
+ /dashed { [9 InvScaleFactor mul dup ] 0 setdash } bind def
57
+ /dotted { [1 InvScaleFactor mul 6 InvScaleFactor mul] 0 setdash } bind def
58
+ /invis {/fill {newpath} def /stroke {newpath} def /show {pop newpath} def} bind def
59
+ /bold { 2 setlinewidth } bind def
60
+ /filled { } bind def
61
+ /unfilled { } bind def
62
+ /rounded { } bind def
63
+ /diagonals { } bind def
64
+
65
+ % hooks for setting color
66
+ /nodecolor { sethsbcolor } bind def
67
+ /edgecolor { sethsbcolor } bind def
68
+ /graphcolor { sethsbcolor } bind def
69
+ /nopcolor {pop pop pop} bind def
70
+
71
+ /beginpage { % i j npages
72
+ /npages exch def
73
+ /j exch def
74
+ /i exch def
75
+ /str 10 string def
76
+ npages 1 gt {
77
+ gsave
78
+ coordfont setfont
79
+ 0 0 moveto
80
+ (\() show i str cvs show (,) show j str cvs show (\)) show
81
+ grestore
82
+ } if
83
+ } bind def
84
+
85
+ /set_font {
86
+ findfont exch
87
+ scalefont setfont
88
+ } def
89
+
90
+ % draw text fitted to its expected width
91
+ /alignedtext { % width text
92
+ /text exch def
93
+ /width exch def
94
+ gsave
95
+ width 0 gt {
96
+ [] 0 setdash
97
+ text stringwidth pop width exch sub text length div 0 text ashow
98
+ } if
99
+ grestore
100
+ } def
101
+
102
+ /boxprim { % xcorner ycorner xsize ysize
103
+ 4 2 roll
104
+ moveto
105
+ 2 copy
106
+ exch 0 rlineto
107
+ 0 exch rlineto
108
+ pop neg 0 rlineto
109
+ closepath
110
+ } bind def
111
+
112
+ /ellipse_path {
113
+ /ry exch def
114
+ /rx exch def
115
+ /y exch def
116
+ /x exch def
117
+ matrix currentmatrix
118
+ newpath
119
+ x y translate
120
+ rx ry scale
121
+ 0 0 1 0 360 arc
122
+ setmatrix
123
+ } bind def
124
+
125
+ /endpage { showpage } bind def
126
+ /showpage { } def
127
+
128
+ /layercolorseq
129
+ [ % layer color sequence - darkest to lightest
130
+ [0 0 0]
131
+ [.2 .8 .8]
132
+ [.4 .8 .8]
133
+ [.6 .8 .8]
134
+ [.8 .8 .8]
135
+ ]
136
+ def
137
+
138
+ /layerlen layercolorseq length def
139
+
140
+ /setlayer {/maxlayer exch def /curlayer exch def
141
+ layercolorseq curlayer 1 sub layerlen mod get
142
+ aload pop sethsbcolor
143
+ /nodecolor {nopcolor} def
144
+ /edgecolor {nopcolor} def
145
+ /graphcolor {nopcolor} def
146
+ } bind def
147
+
148
+ /onlayer { curlayer ne {invis} if } def
149
+
150
+ /onlayers {
151
+ /myupper exch def
152
+ /mylower exch def
153
+ curlayer mylower lt
154
+ curlayer myupper gt
155
+ or
156
+ {invis} if
157
+ } def
158
+
159
+ /curlayer 0 def
160
+
161
+ %%EndResource
162
+ %%EndProlog
163
+ %%BeginSetup
164
+ 14 default-font-family set_font
165
+ 1 setmiterlimit
166
+ % /arrowlength 10 def
167
+ % /arrowwidth 5 def
168
+
169
+ % make sure pdfmark is harmless for PS-interpreters other than Distiller
170
+ /pdfmark where {pop} {userdict /pdfmark /cleartomark load put} ifelse
171
+ % make '<<' and '>>' safe on PS Level 1 devices
172
+ /languagelevel where {pop languagelevel}{1} ifelse
173
+ 2 lt {
174
+ userdict (<<) cvn ([) cvn load put
175
+ userdict (>>) cvn ([) cvn load put
176
+ } if
177
+
178
+ %%EndSetup
179
+ %! Greg shapes for GraphViz/DOT
180
+
181
+ % input format :
182
+ % [ 54 36 0 36 0 0 54 0 54 36 ] 4 false yourshape
183
+ % or
184
+ % [ 54 36 0 36 0 0 54 0 54 36 ] 4 true yourshape
185
+ % [ 150 150 100 150 100 100 150 100 150 150 ] 4 true yourshape
186
+ %
187
+ % [upper right (y, x), lower right (y, x), lower left (y, x), upper left (y, x), upper right (y, x)]
188
+
189
+ /xdef {exch def} bind def
190
+
191
+ /rgv_box {
192
+ 10 dict begin
193
+ /fflag xdef
194
+ /sides xdef
195
+
196
+ 4 sides ne { stop } if
197
+
198
+ aload pop
199
+
200
+ newpath
201
+ moveto
202
+ lineto
203
+ lineto
204
+ lineto
205
+ closepath
206
+
207
+ pop pop
208
+
209
+ fflag { fill } { stroke } ifelse
210
+ end
211
+ } bind def
212
+
213
+ /rgv_cloud {
214
+ 10 dict begin
215
+ /fflag xdef
216
+ /sides xdef
217
+
218
+ % Check if we have 4 sides. Else stop
219
+ 4 sides ne { stop } if
220
+
221
+ % (aload) takes an array as its argument and places the individual elements
222
+ % of that array, and then the array itself, on the stack. Then (pop) remove
223
+ % the top element from the stack (the array)
224
+ aload pop
225
+
226
+ /ury xdef /urx xdef
227
+ /lry xdef /lrx xdef
228
+ /lly xdef /llx xdef
229
+ /uly xdef /ulx xdef
230
+ pop pop
231
+
232
+ /mx lrx llx neg add 2 div def
233
+ /my uly lly neg add 2 div def
234
+
235
+ % empty the current path and declares we are starting a new path
236
+ newpath
237
+
238
+ urx ury my neg add my 270 90 arc
239
+ ulx mx add uly mx 0 180 arc
240
+ llx lly my add my 90 270 arc
241
+ lrx lry lineto
242
+
243
+ closepath
244
+
245
+ % The stroke operator on line four causes the path we have constructed to be
246
+ % painted onto the current page.
247
+ % The fill operator fills the current path with ink.
248
+ fflag { fill } { stroke } ifelse
249
+ end
250
+ } bind def
251
+
252
+ /rgv_flower {
253
+ 10 dict begin
254
+ /fflag xdef
255
+ /sides xdef
256
+
257
+ % Check if we have 4 sides. Else stop
258
+ 4 sides ne { stop } if
259
+
260
+ % (aload) takes an array as its argument and places the individual elements
261
+ % of that array, and then the array itself, on the stack. Then (pop) remove
262
+ % the top element from the stack (the array)
263
+ aload pop
264
+
265
+ /ury xdef /urx xdef
266
+ /lry xdef /lrx xdef
267
+ /lly xdef /llx xdef
268
+ /uly xdef /ulx xdef
269
+ pop pop
270
+
271
+ /mx lrx llx neg add 2 div def
272
+ /my uly lly neg add 2 div def
273
+
274
+ % empty the current path and declares we are starting a new path
275
+ newpath
276
+
277
+ % Arcs
278
+ urx ury my neg add my 270 90 arc
279
+ ulx mx add uly mx 0 180 arc
280
+ llx lly my add my 90 270 arc
281
+ lrx mx neg add lry mx 180 0 arc
282
+
283
+ closepath
284
+
285
+ % The stroke operator on line four causes the path we have constructed to be
286
+ % painted onto the current page.
287
+ % The fill operator fills the current path with ink.
288
+ fflag { fill } { stroke } ifelse
289
+ end
290
+ } bind def
291
+
292
+ %[ 150 150 50 150 50 100 150 100 150 150 ] 4 false rgv_box
293
+ %[ 250 250 150 250 150 200 250 200 250 250 ] 4 false rgv_flower
294
+ %[ 350 350 250 350 250 300 350 300 350 350 ] 4 false rgv_cloud
295
+ %
296
+ %.5 setgray
297
+ %[ 150 450 50 450 50 400 150 400 150 450 ] 4 true rgv_box
298
+ %.5 setgray
299
+ %[ 250 550 150 550 150 500 250 500 250 550 ] 4 true rgv_flower
300
+ %.5 setgray
301
+ %[ 350 650 250 650 250 600 350 600 350 650 ] 4 true rgv_cloud
302
+ %
303
+ %showpage
304
+
305
+ setupLatin1
306
+ %%Page: 1 1
307
+ %%PageBoundingBox: 242 301 370 491
308
+ %%PageOrientation: Portrait
309
+ 0 0 1 beginpage
310
+ gsave
311
+ 242 301 128 190 boxprim clip newpath
312
+ 1 1 set_scale 0 rotate 246 306 translate
313
+ % A
314
+ gsave
315
+ 1 setlinewidth
316
+ 0 0 0 nodecolor
317
+ [ 87 182 33 182 33 146 87 146 87 182 ] 4 false rgv_box
318
+ 0 0 0 nodecolor
319
+ 14 /Times-Roman set_font
320
+ 54.5 158.9 moveto 11 (A) alignedtext
321
+ grestore
322
+ % Bonjour le monde\nComment va tu ?
323
+ gsave
324
+ 1 setlinewidth
325
+ 0 0 0 nodecolor
326
+ [ 120 110 0 110 0 72 120 72 120 110 ] 4 false rgv_cloud
327
+ 0 0 0 nodecolor
328
+ 14 /Times-Roman set_font
329
+ 7.5 93.4 moveto 105 (Bonjour le monde) alignedtext
330
+ 0 0 0 nodecolor
331
+ 14 /Times-Roman set_font
332
+ 11 78.4 moveto 98 (Comment va tu ?) alignedtext
333
+ grestore
334
+ % A->Bonjour le monde\nComment va tu ?
335
+ gsave
336
+ 1 setlinewidth
337
+ 0 0 0 edgecolor
338
+ newpath 60 145.96 moveto
339
+ 60 138.21 60 128.96 60 120.28 curveto
340
+ stroke
341
+ 0 0 0 edgecolor
342
+ newpath 63.5 120.11 moveto
343
+ 60 110.11 lineto
344
+ 56.5 120.11 lineto
345
+ closepath fill
346
+ 1 setlinewidth
347
+ solid
348
+ 0 0 0 edgecolor
349
+ newpath 63.5 120.11 moveto
350
+ 60 110.11 lineto
351
+ 56.5 120.11 lineto
352
+ closepath stroke
353
+ grestore
354
+ % C
355
+ gsave
356
+ 1 setlinewidth
357
+ 0 0 0 nodecolor
358
+ [ 87 36 33 36 33 0 87 0 87 36 ] 4 false rgv_flower
359
+ 0 0 0 nodecolor
360
+ 14 /Times-Roman set_font
361
+ 55 12.9 moveto 10 (C) alignedtext
362
+ grestore
363
+ % Bonjour le monde\nComment va tu ?->C
364
+ gsave
365
+ 1 setlinewidth
366
+ 0 0 0 edgecolor
367
+ newpath 60 71.82 moveto
368
+ 60 64.1 60 55.03 60 46.56 curveto
369
+ stroke
370
+ 0 0 0 edgecolor
371
+ newpath 63.5 46.3 moveto
372
+ 60 36.3 lineto
373
+ 56.5 46.3 lineto
374
+ closepath fill
375
+ 1 setlinewidth
376
+ solid
377
+ 0 0 0 edgecolor
378
+ newpath 63.5 46.3 moveto
379
+ 60 36.3 lineto
380
+ 56.5 46.3 lineto
381
+ closepath stroke
382
+ grestore
383
+ endpage
384
+ showpage
385
+ grestore
386
+ %%PageTrailer
387
+ %%EndPage: 1
388
+ %%Trailer
389
+ %%Pages: 1
390
+ %%BoundingBox: 242 301 370 491
391
+ end
392
+ restore
393
+ %%EOF
data/examples/sample28.rb CHANGED
@@ -3,7 +3,7 @@
3
3
  $:.unshift( "../lib" );
4
4
  require "graphviz"
5
5
 
6
- puts GraphViz.new(:G){ |g|
6
+ GraphViz.new(:G){ |g|
7
7
  g[:ratio => "auto", :label => "I love the world!"]
8
8
 
9
9
  g.hello( :label => "Hello", :color => "blue" ) # You can do this
@@ -0,0 +1,10 @@
1
+ #!/usr/bin/ruby
2
+
3
+ $:.unshift( "../lib" );
4
+ require "graphviz"
5
+
6
+ GraphViz.new(:g){ |g|
7
+ a = g.add_node( "A:B:C", :shape => :record )
8
+ b = g.add_node( "D:E:F", :shape => :ellipse )
9
+ a << b
10
+ }.save( :png => "#{$0}.png" )
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/ruby
2
+
3
+ $:.unshift( "../lib" );
4
+ require "graphviz"
5
+
6
+ GraphViz.new(:G){ |g|
7
+ g.edge[:arrowsize => 0.5]
8
+ g.graph[:bb => "0,0,638,256"]
9
+ g.person[:shape => :record];
10
+ g.driver[:shape => :ellipse];
11
+ g.owner[:shape => :ellipse];
12
+ g.passenger[:shape => :ellipse];
13
+ g.vehicle[:shape => :record];
14
+ }.save( :png => "#{$0}.png" )
data/lib/graphviz.rb CHANGED
@@ -63,6 +63,9 @@ class GraphViz
63
63
  @graph
64
64
  @node
65
65
  @edge
66
+
67
+ # This accessor allow you to set global graph attributs
68
+ attr_accessor :graph
66
69
 
67
70
  # This accessor allow you to set global nodes attributs
68
71
  attr_accessor :node
@@ -85,6 +88,11 @@ class GraphViz
85
88
  @hoNodes[xNodeName] = GraphViz::Node::new( xNodeName, self )
86
89
 
87
90
  if hOpt.nil? == false and hOpt[0].nil? == false
91
+
92
+ unless hOpt[0].keys.include?(:label) or hOpt[0].keys.include?("label")
93
+ hOpt[0][:label] = xNodeName
94
+ end
95
+
88
96
  hOpt[0].each do |xKey, xValue|
89
97
  @hoNodes[xNodeName][xKey.to_s] = xValue
90
98
  end
@@ -110,6 +118,22 @@ class GraphViz
110
118
  return node
111
119
  end
112
120
 
121
+ #
122
+ # Allow you to traverse nodes
123
+ #
124
+ def each_node( &block )
125
+ @hoNodes.each do |name, node|
126
+ yield( name, node )
127
+ end
128
+ end
129
+
130
+ #
131
+ # Get the number of nodes
132
+ #
133
+ def node_count
134
+ @hoNodes.size
135
+ end
136
+
113
137
  ##
114
138
  # Create a new edge
115
139
  #
@@ -150,6 +174,22 @@ class GraphViz
150
174
  end
151
175
  end
152
176
 
177
+ #
178
+ # Allow you to traverse edges
179
+ #
180
+ def each_edge( &block )
181
+ @loEdges.each do |edge|
182
+ yield(edge)
183
+ end
184
+ end
185
+
186
+ #
187
+ # Get the number of edges
188
+ #
189
+ def edge_count
190
+ @loEdges.size
191
+ end
192
+
153
193
  #
154
194
  # Create a new graph
155
195
  #
@@ -187,17 +227,19 @@ class GraphViz
187
227
  end
188
228
 
189
229
  #
190
- # Get the number of nodes
230
+ # Allow you to traverse graphs
191
231
  #
192
- def node_count
193
- @hoNodes.size
232
+ def each_graph( &block )
233
+ @hoGraphs.each do |name, graph|
234
+ yield( name, graph )
235
+ end
194
236
  end
195
237
 
196
238
  #
197
- # Get the number of edges
239
+ # Get the number of graphs
198
240
  #
199
- def edge_count
200
- @loEdges.size
241
+ def graph_count
242
+ @hoGraphs.size
201
243
  end
202
244
 
203
245
  def method_missing( idName, *args, &block ) #:nodoc:
@@ -31,10 +31,16 @@ class GraphViz
31
31
  end
32
32
 
33
33
  def []( xKey )
34
- if @data.key?( xKey.to_s ) == false
35
- nil
34
+ if xKey.class == Hash
35
+ xKey.each do |k, v|
36
+ self[k] = v
37
+ end
38
+ else
39
+ if @data.key?( xKey.to_s ) == false
40
+ nil
41
+ end
42
+ @data[xKey.to_s]
36
43
  end
37
- @data[xKey.to_s]
38
44
  end
39
45
 
40
46
  def []=( xKey, xValue )
@@ -40,7 +40,7 @@
40
40
  # C => cluster
41
41
  #
42
42
  module Constants
43
- RGV_VERSION = "0.9.8"
43
+ RGV_VERSION = "0.9.9"
44
44
 
45
45
  ## Const: Output formats
46
46
  FORMATS = [
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby-graphviz
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.8
4
+ version: 0.9.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gregoire Lejeune
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2010-01-17 00:00:00 +01:00
12
+ date: 2010-02-12 00:00:00 +01:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -64,6 +64,9 @@ files:
64
64
  - examples/maketest.bat
65
65
  - examples/maketest.sh
66
66
  - examples/p2p.rb
67
+ - examples/rgv/rgv.ps
68
+ - examples/rgv/test_rgv.rb
69
+ - examples/rgv/test_rgv.rb.ps
67
70
  - examples/sample01.rb
68
71
  - examples/sample02.rb
69
72
  - examples/sample03.rb
@@ -94,6 +97,8 @@ files:
94
97
  - examples/sample28.rb
95
98
  - examples/sample29.rb
96
99
  - examples/sample30.rb
100
+ - examples/sample31.rb
101
+ - examples/sample32.rb
97
102
  - examples/sdlshapes/README
98
103
  - examples/sdlshapes/sdl.ps
99
104
  - examples/sdlshapes/sdlshapes.dot