ruby-graphviz 0.9.4 → 0.9.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/AUTHORS +1 -0
- data/ChangeLog +5 -0
- data/examples/sample26.rb +8 -0
- data/lib/graphviz.rb +35 -9
- data/lib/graphviz/constants.rb +1 -1
- data/lib/graphviz/edge.rb +10 -2
- metadata +3 -2
data/AUTHORS
CHANGED
data/ChangeLog
CHANGED
data/lib/graphviz.rb
CHANGED
@@ -15,7 +15,7 @@
|
|
15
15
|
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
16
16
|
|
17
17
|
require 'tempfile'
|
18
|
-
require 'mkmf'
|
18
|
+
# require 'mkmf'
|
19
19
|
|
20
20
|
require 'graphviz/node'
|
21
21
|
require 'graphviz/edge'
|
@@ -636,20 +636,46 @@ class GraphViz
|
|
636
636
|
# Escape a string to be acceptable as a node name in a graphviz input file
|
637
637
|
#
|
638
638
|
def self.escape(str, force = false) #:nodoc:
|
639
|
-
if force or str.match( /\A[a-zA-Z_]+[a-zA-Z0-9_
|
640
|
-
'"' + str.gsub('"', '\\"').gsub("\n", '\\\\n') + '"'
|
639
|
+
if force or str.match( /\A[a-zA-Z_]+[a-zA-Z0-9_:]*\Z/ ).nil?
|
640
|
+
'"' + str.gsub('"', '\\"').gsub("\n", '\\\\n').gsub(".","\\.") + '"'
|
641
641
|
else
|
642
642
|
str
|
643
643
|
end
|
644
644
|
end
|
645
645
|
|
646
|
-
def find_executable( ) #:nodoc:
|
647
|
-
|
648
|
-
|
649
|
-
|
650
|
-
|
646
|
+
# def find_executable( ) #:nodoc:
|
647
|
+
# cmd = find_executable0( @prog )
|
648
|
+
# if cmd == nil and @path != nil
|
649
|
+
# __cmd = File.join( @path, @prog )
|
650
|
+
# cmd = __cmd if File.executable?( __cmd )
|
651
|
+
# end
|
652
|
+
# return cmd
|
653
|
+
# end
|
654
|
+
|
655
|
+
# Since this code is an adaptation of Launchy::Application#find_executable
|
656
|
+
# (http://copiousfreetime.rubyforge.org/launchy/Launchy/Application.html)
|
657
|
+
# it follow is licence :
|
658
|
+
#
|
659
|
+
# Permission to use, copy, modify, and/or distribute this software for any
|
660
|
+
# purpose with or without fee is hereby granted, provided that the above
|
661
|
+
# copyright notice and this permission notice appear in all copies.
|
662
|
+
#
|
663
|
+
# THE SOFTWARE IS PROVIDED “AS IS” AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
664
|
+
# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
665
|
+
# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
|
666
|
+
# SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
667
|
+
# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
|
668
|
+
# OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
|
669
|
+
# CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
670
|
+
def find_executable(bin = @prog, *paths) #:nodoc:
|
671
|
+
paths = ENV['PATH'].split(File::PATH_SEPARATOR) if paths.empty?
|
672
|
+
paths.each do |path|
|
673
|
+
file = File.join(path,bin)
|
674
|
+
if File.executable?(file) then
|
675
|
+
return file
|
676
|
+
end
|
651
677
|
end
|
652
|
-
return
|
678
|
+
return nil
|
653
679
|
end
|
654
680
|
end
|
655
681
|
|
data/lib/graphviz/constants.rb
CHANGED
data/lib/graphviz/edge.rb
CHANGED
@@ -60,10 +60,18 @@ class GraphViz
|
|
60
60
|
end
|
61
61
|
|
62
62
|
#
|
63
|
-
#
|
63
|
+
# Set values for edge attributs or
|
64
|
+
# get the value of the given edge attribut +xAttrName+
|
64
65
|
#
|
65
66
|
def []( xAttrName )
|
66
|
-
|
67
|
+
# Modification by axgle (http://github.com/axgle)
|
68
|
+
if Hash === xAttrName
|
69
|
+
xAttrName.each do |key, value|
|
70
|
+
self[key] = value
|
71
|
+
end
|
72
|
+
else
|
73
|
+
@oAttrEdge[xAttrName.to_s].clone
|
74
|
+
end
|
67
75
|
end
|
68
76
|
|
69
77
|
def <<( oNode ) #:nodoc:
|
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.
|
4
|
+
version: 0.9.5
|
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: 2009-
|
12
|
+
date: 2009-11-17 00:00:00 +01:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -86,6 +86,7 @@ files:
|
|
86
86
|
- examples/sample23.rb
|
87
87
|
- examples/sample24.rb
|
88
88
|
- examples/sample25.rb
|
89
|
+
- examples/sample26.rb
|
89
90
|
- examples/shapes.rb
|
90
91
|
- examples/test.xml
|
91
92
|
- examples/testorder.rb
|