pxgraphviz 0.2.3 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +1 -3
- data/lib/pxgraphviz.rb +35 -8
- metadata +21 -1
- metadata.gz.sig +3 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6ace7b1de200b59db1fe045fdbab20a15cb6dd4c
|
4
|
+
data.tar.gz: 10b8ffb3a80bf5faf32d59b60bdf41518e69d611
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a5236fc70f4a6311943fa08867c4f6d4a3c046be855e48874b7a93b512b4864fa528ccc4b9b682e4c376b55d6ebfdad9aad63f1eccbd1f6d6c0e849081b1a318
|
7
|
+
data.tar.gz: 397ebb508a16a881739fba371431f3140054ba93dd76c5568b6c7a8dc67695c2ff2e005d03be2e9f673d13ec698853f278c781f72d804c14e35b6504de480140
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
data/lib/pxgraphviz.rb
CHANGED
@@ -4,6 +4,7 @@
|
|
4
4
|
|
5
5
|
|
6
6
|
require 'polyrex'
|
7
|
+
require 'graphvizml'
|
7
8
|
|
8
9
|
|
9
10
|
class PxGraphViz
|
@@ -13,22 +14,49 @@ class PxGraphViz
|
|
13
14
|
|
14
15
|
if s =~ /^<\?/ then
|
15
16
|
|
16
|
-
|
17
|
-
|
17
|
+
px = Polyrex.new
|
18
|
+
px.import s
|
18
19
|
|
19
20
|
else
|
20
|
-
|
21
|
+
px = Polyrex.new s
|
21
22
|
|
22
23
|
end
|
23
24
|
|
25
|
+
@doc = build(px)
|
26
|
+
|
24
27
|
end
|
25
|
-
|
28
|
+
|
26
29
|
def to_doc()
|
30
|
+
@doc
|
31
|
+
end
|
32
|
+
|
33
|
+
def to_dot()
|
34
|
+
GraphVizML.new(@doc).to_dot
|
35
|
+
end
|
36
|
+
|
37
|
+
# writes to a PNG file (not a PNG blob)
|
38
|
+
#
|
39
|
+
def to_png(filename)
|
40
|
+
GraphVizML.new(@doc).to_png filename
|
41
|
+
'PNG file written'
|
42
|
+
end
|
43
|
+
|
44
|
+
# writes to a SVG file (not an SVG blob)
|
45
|
+
#
|
46
|
+
def to_svg(filename)
|
47
|
+
GraphVizML.new(@doc).to_svg filename
|
48
|
+
'SVG file written'
|
49
|
+
end
|
50
|
+
|
51
|
+
|
52
|
+
private
|
53
|
+
|
54
|
+
def build(px)
|
27
55
|
|
28
56
|
# The issue with 2 nodes having the same name has yet to be rectified
|
29
57
|
#jr020917 labels = @px.xpath('//records/item/summary/label/text()').uniq
|
30
58
|
|
31
|
-
summary =
|
59
|
+
summary = px.xpath('//records/item/summary')
|
32
60
|
labels = summary.map do |x|
|
33
61
|
label = x.text('label')
|
34
62
|
shape = x.element('shape')
|
@@ -62,7 +90,7 @@ class PxGraphViz
|
|
62
90
|
|
63
91
|
|
64
92
|
a_edges = []
|
65
|
-
|
93
|
+
px.each_recursive do |x, parent, level|
|
66
94
|
|
67
95
|
next if level <= 0
|
68
96
|
a_edges << [
|
@@ -73,7 +101,6 @@ class PxGraphViz
|
|
73
101
|
|
74
102
|
end
|
75
103
|
|
76
|
-
|
77
104
|
# Create a document of the nodes
|
78
105
|
|
79
106
|
edge_records = RexleBuilder.build do |xml|
|
@@ -124,7 +151,7 @@ STYLE
|
|
124
151
|
a = RexleBuilder.new(h).to_a
|
125
152
|
a[0] = 'gvml'
|
126
153
|
|
127
|
-
summary =
|
154
|
+
summary = px.summary.to_h
|
128
155
|
|
129
156
|
a[1] = %i(type direction).inject({}) do |r,x|
|
130
157
|
r.merge(x => summary[x]) if summary.has_key? x
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pxgraphviz
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Robertson
|
@@ -53,6 +53,26 @@ dependencies:
|
|
53
53
|
- - ">="
|
54
54
|
- !ruby/object:Gem::Version
|
55
55
|
version: 1.1.12
|
56
|
+
- !ruby/object:Gem::Dependency
|
57
|
+
name: graphvizml
|
58
|
+
requirement: !ruby/object:Gem::Requirement
|
59
|
+
requirements:
|
60
|
+
- - "~>"
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
version: '0.4'
|
63
|
+
- - ">="
|
64
|
+
- !ruby/object:Gem::Version
|
65
|
+
version: 0.4.1
|
66
|
+
type: :runtime
|
67
|
+
prerelease: false
|
68
|
+
version_requirements: !ruby/object:Gem::Requirement
|
69
|
+
requirements:
|
70
|
+
- - "~>"
|
71
|
+
- !ruby/object:Gem::Version
|
72
|
+
version: '0.4'
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: 0.4.1
|
56
76
|
description:
|
57
77
|
email: james@jamesrobertson.eu
|
58
78
|
executables: []
|
metadata.gz.sig
CHANGED
@@ -1 +1,3 @@
|
|
1
|
-
|
1
|
+
Tc!3�� I��
|
2
|
+
���R�0]m�z�8�ϸ|�*Bʠ�<��f�d�1�Ҭ>�~P��!!V��+�x��~����TGrT-)��� #�e�^T�j�յ��u��%{�*��}
|
3
|
+
��)��%A��0#ĩZ���NQ�����hi�'Y��.�$��$o/\�iq�$�e�S�ܗ��*�E_�Ԛ�N�t�ޗ6P���m�M�j�l1��V_\����/�����[�@a�R|#9�����E|5è)
|