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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e988483e29d912ad503df58c5fcc58dfe072ab01
4
- data.tar.gz: 871a8bc39cdef9821bffd2dd9ff3cd4d5319befe
3
+ metadata.gz: 18239393b6c66a8f5d816b7979cafd2c20b776cc
4
+ data.tar.gz: db793639ff4f60ce8ea1246f17e0a636ed54a136
5
5
  SHA512:
6
- metadata.gz: d06f7a40cadf52e9eff060810207fbafe0150ba7069b79c489808b8b3cce51b08ed0b5c0af0e39e4823a5cedb3d2e33a3aa434048c820e8c4945cb160c883e76
7
- data.tar.gz: dd6a3ff9bbfd2eafa35764c2fc04d420b49b3bc5d58aef3ac59ce2b179fbfe377938ba846c33cc6999989dbb3c5a95391a86ef8edc4c0230ff0536d9fce5c3ef
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
- @px = Polyrex.new
15
- @px.import s
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 |val, i|
33
- xml.node(id: i.to_s) do
34
- xml.label val
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.0
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-01-07 00:00:00.000000000 Z
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.9
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.9
55
+ version: 1.1.12
56
56
  description:
57
57
  email: james@jamesrobertson.eu
58
58
  executables: []
metadata.gz.sig CHANGED
Binary file