pxgraphviz 0.2.0 → 0.2.1
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.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/lib/pxgraphviz.rb +27 -7
- metadata +4 -4
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 18239393b6c66a8f5d816b7979cafd2c20b776cc
|
|
4
|
+
data.tar.gz: db793639ff4f60ce8ea1246f17e0a636ed54a136
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 5a8db895f10a0174f897482dd4080fc84b27e2d4209bdd509c8ad8a7dbf2d44999cbc6faa1f4fed950d2c32411a541c2549f4c68da08541fc957c244171c2855
|
|
7
|
+
data.tar.gz: c97211de382c436263fca20e502ece8e99b4e881c854463bd581d525d504216df0414b447c61417b94c2701861fa59b11891b67123652f1b9afb0e6706eaf2fd
|
checksums.yaml.gz.sig
CHANGED
|
Binary file
|
data.tar.gz.sig
CHANGED
|
Binary file
|
data/lib/pxgraphviz.rb
CHANGED
|
@@ -11,14 +11,30 @@ class PxGraphViz
|
|
|
11
11
|
|
|
12
12
|
def initialize(s)
|
|
13
13
|
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
if s =~ /^<\?/ then
|
|
15
|
+
|
|
16
|
+
@px = Polyrex.new
|
|
17
|
+
@px.import s
|
|
16
18
|
|
|
19
|
+
else
|
|
20
|
+
@px = Polyrex.new s
|
|
21
|
+
|
|
22
|
+
end
|
|
23
|
+
|
|
17
24
|
end
|
|
18
25
|
|
|
19
26
|
def to_doc()
|
|
20
27
|
|
|
21
|
-
labels = @px.xpath('//records/item/summary/label/text()').uniq
|
|
28
|
+
#jr020917 labels = @px.xpath('//records/item/summary/label/text()').uniq
|
|
29
|
+
|
|
30
|
+
summary = @px.xpath('//records/item/summary')
|
|
31
|
+
labels = summary.map do |x|
|
|
32
|
+
label = x.text('label')
|
|
33
|
+
shape = x.element('shape')
|
|
34
|
+
|
|
35
|
+
[label, shape.text || 'box' ]
|
|
36
|
+
|
|
37
|
+
end
|
|
22
38
|
|
|
23
39
|
ids = labels.length.times.map {|i| i+1}
|
|
24
40
|
|
|
@@ -29,16 +45,18 @@ class PxGraphViz
|
|
|
29
45
|
node_records = RexleBuilder.build do |xml|
|
|
30
46
|
|
|
31
47
|
xml.records do
|
|
32
|
-
labels_ids.each do |
|
|
33
|
-
|
|
34
|
-
|
|
48
|
+
labels_ids.each do |x, i|
|
|
49
|
+
label, shape = x
|
|
50
|
+
attr = {id: i.to_s, shape: shape}
|
|
51
|
+
xml.node(attr) do
|
|
52
|
+
xml.label label
|
|
35
53
|
end
|
|
36
54
|
end
|
|
37
55
|
end
|
|
38
56
|
|
|
39
57
|
end
|
|
40
58
|
|
|
41
|
-
a_nodes = labels.zip(node_records[3..-1])
|
|
59
|
+
a_nodes = labels.map(&:first).zip(node_records[3..-1])
|
|
42
60
|
h_nodes = a_nodes.to_h
|
|
43
61
|
|
|
44
62
|
|
|
@@ -101,6 +119,8 @@ style = '
|
|
|
101
119
|
|
|
102
120
|
a = RexleBuilder.new(h).to_a
|
|
103
121
|
a[0] = 'gvml'
|
|
122
|
+
a[1] = {direction: @px.summary.direction} if @px.summary.direction
|
|
123
|
+
|
|
104
124
|
Rexle.new(a)
|
|
105
125
|
|
|
106
126
|
end
|
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.2.
|
|
4
|
+
version: 0.2.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- James Robertson
|
|
@@ -31,7 +31,7 @@ cert_chain:
|
|
|
31
31
|
AJ2kmROiYBLscpVrfyHxtEJluJwbid/KyR/BybHL7uezZ2/EbCxCYanOIbNyctTp
|
|
32
32
|
CNgZvs+F41zO7g==
|
|
33
33
|
-----END CERTIFICATE-----
|
|
34
|
-
date: 2017-
|
|
34
|
+
date: 2017-09-02 00:00:00.000000000 Z
|
|
35
35
|
dependencies:
|
|
36
36
|
- !ruby/object:Gem::Dependency
|
|
37
37
|
name: polyrex
|
|
@@ -42,7 +42,7 @@ dependencies:
|
|
|
42
42
|
version: '1.1'
|
|
43
43
|
- - ">="
|
|
44
44
|
- !ruby/object:Gem::Version
|
|
45
|
-
version: 1.1.
|
|
45
|
+
version: 1.1.12
|
|
46
46
|
type: :runtime
|
|
47
47
|
prerelease: false
|
|
48
48
|
version_requirements: !ruby/object:Gem::Requirement
|
|
@@ -52,7 +52,7 @@ dependencies:
|
|
|
52
52
|
version: '1.1'
|
|
53
53
|
- - ">="
|
|
54
54
|
- !ruby/object:Gem::Version
|
|
55
|
-
version: 1.1.
|
|
55
|
+
version: 1.1.12
|
|
56
56
|
description:
|
|
57
57
|
email: james@jamesrobertson.eu
|
|
58
58
|
executables: []
|
metadata.gz.sig
CHANGED
|
Binary file
|