pxgraphviz 0.1.0

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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: df8acdacf026a578e3a1e05b96251d6807a6fcf5
4
+ data.tar.gz: c99b44081e5da991ad20fd71425fc80a3b13714d
5
+ SHA512:
6
+ metadata.gz: 661b9432f1f5295d3708de8cc6c76ae5f4cbf9c408181fa4620142713bce3caec5d5f6575e38213fd176d777cc732e25baf6a80ec7ded237c25dcbfe3107bf82
7
+ data.tar.gz: 29b31b35a709b2d3f3cd4f6de804be563e07e11d7b3eb4c4a68d2f8343c1358ce25e62c9be8048e6ff3514a70d07ab58eeb58b0eec3ce9c06ac7b766c7f7820f
checksums.yaml.gz.sig ADDED
@@ -0,0 +1 @@
1
+ \����F+�ׇ ��Z;�]8J?�vZ&�^�w���m(�f���Wޏ�*��f�:%=��6����h��<�6��n�S-FV�4zEX�� J�N�̓��
data/lib/pxgraphviz.rb ADDED
@@ -0,0 +1,111 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ # file: pxgraphviz.rb
4
+
5
+
6
+ require 'polyrex'
7
+
8
+
9
+ class PxGraphViz
10
+
11
+
12
+ def initialize(s)
13
+
14
+ @px = Polyrex.new
15
+ @px.import s
16
+
17
+ end
18
+
19
+ def to_doc()
20
+
21
+ labels = @px.xpath('//records/item/summary/label/text()').uniq
22
+
23
+ ids = labels.length.times.map {|i| i+1}
24
+
25
+ labels_ids = labels.zip ids
26
+
27
+ # Create a document of the nodes
28
+
29
+ node_records = RexleBuilder.build do |xml|
30
+
31
+ xml.records do
32
+ labels_ids.each do |val, i|
33
+ xml.node(id: i.to_s) do
34
+ xml.label val
35
+ end
36
+ end
37
+ end
38
+
39
+ end
40
+
41
+ a_nodes = labels.zip(node_records[3..-1])
42
+ h_nodes = a_nodes.to_h
43
+
44
+
45
+ a_edges = []
46
+ @px.each_recursive do |x, parent, level|
47
+
48
+ next if level <= 0
49
+ a_edges << [parent.label, x.label]
50
+
51
+ end
52
+
53
+
54
+ # Create a document of the nodes
55
+
56
+ edge_records = RexleBuilder.build do |xml|
57
+
58
+ xml.records do
59
+ a_edges.each do |item1, item2|
60
+ xml.edge do
61
+ xml.summary
62
+ xml.records { RexleArray.new([h_nodes[item1], h_nodes[item2]])}
63
+ end
64
+ end
65
+ end
66
+
67
+ end
68
+
69
+ h_doc = {
70
+
71
+ options: {
72
+ summary: '',
73
+ records:
74
+ [['option', {}, '',
75
+ ['summary',{},'', ['type',{}, 'node']],
76
+ ['records',{}, '',
77
+ ['attribute', {name: 'color', value: '#ddaa66'}],
78
+ ['attribute', {name: 'style', value: 'filled'}],
79
+ ['attribute', {name: 'shape', value: 'box'}],
80
+ ['attribute', {name: 'penwidth', value: '1'}],
81
+ ['attribute', {name: 'fontname', value: 'Trebuchet MS'}],
82
+ ['attribute', {name: 'fontsize', value: '8'}],
83
+ ['attribute', {name: 'fillcolor', value: '#775500'}],
84
+ ['attribute', {name: 'fontcolor', value: '#ffeecc'}],
85
+ ['attribute', {name: 'margin', value: '0.0'}]
86
+ ]
87
+ ],
88
+ ['option', {}, '',
89
+ ['summary', {}, '', ['type', {}, 'edge']],
90
+ ['records', {}, '',
91
+ ['attribute', {name: 'color', value: '#ddaa66'}],
92
+ ['attribute', {name: 'weight', value: '1'}],
93
+ ['attribute', {name: 'fontsize', value: '8'}],
94
+ ['attribute', {name: 'fontcolor', value: '#ffeecc'}],
95
+ ['attribute', {name: 'fontname', value: 'Trebuchet MS'}],
96
+ ['attribute', {name: 'dir', value: 'forward'}],
97
+ ['attribute', {name: 'arrowsize', value: '0.5'}]
98
+ ]
99
+ ]]
100
+ },
101
+ nodes: {summary: '', records: node_records},
102
+ edges: {summary: '', records: edge_records[3..-1]}
103
+ }
104
+
105
+ a = RexleBuilder.new(h_doc).to_a
106
+ a[0] = 'gvml'
107
+ Rexle.new(a)
108
+
109
+ end
110
+
111
+ end
data.tar.gz.sig ADDED
@@ -0,0 +1 @@
1
+ �c����XX% �B��y=Na�fWW��`
metadata ADDED
@@ -0,0 +1,87 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: pxgraphviz
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - James Robertson
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain:
11
+ - |
12
+ -----BEGIN CERTIFICATE-----
13
+ MIIDljCCAn6gAwIBAgIBATANBgkqhkiG9w0BAQUFADBIMRIwEAYDVQQDDAlnZW1t
14
+ YXN0ZXIxHjAcBgoJkiaJk/IsZAEZFg5qYW1lc3JvYmVydHNvbjESMBAGCgmSJomT
15
+ 8ixkARkWAmV1MB4XDTE3MDEwNjIwMzk1NloXDTE4MDEwNjIwMzk1NlowSDESMBAG
16
+ A1UEAwwJZ2VtbWFzdGVyMR4wHAYKCZImiZPyLGQBGRYOamFtZXNyb2JlcnRzb24x
17
+ EjAQBgoJkiaJk/IsZAEZFgJldTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoC
18
+ ggEBANpuv8jgkWbZPgFK31Jp8/wyswZKhLE6ecTvsmtcYUZvyTZVIFANCvqv5h4g
19
+ QGgdkw9oe9NAI+xa85w41Ak0F7LWO4IJSriQ1BeB+Iymu6ZckRT4B33M41ZZ/beX
20
+ QmAUa2Vm3r1qRwi6XjFux05UaslXtJDYv3qaNBQdagcA4+qqCZPB0Juc7GIohAsa
21
+ kbr52VPgB7igitYFDRUq8hjxiQoBYZ3JoTncSue4hXVIiIUSDpZ/+vO8vzhxVmtX
22
+ kVQE3uEVkHHJdtYL+l3VDaewkcD2H1K1G5NYIcSKCEAtE5YNNkO1rbd/8WEsefuA
23
+ PB18p9HO7YggbSOgyCfo3obqL10CAwEAAaOBijCBhzAJBgNVHRMEAjAAMAsGA1Ud
24
+ DwQEAwIEsDAdBgNVHQ4EFgQUxAyHz/svWAj+j2v1nzKscqPW6RUwJgYDVR0RBB8w
25
+ HYEbZ2VtbWFzdGVyQGphbWVzcm9iZXJ0c29uLmV1MCYGA1UdEgQfMB2BG2dlbW1h
26
+ c3RlckBqYW1lc3JvYmVydHNvbi5ldTANBgkqhkiG9w0BAQUFAAOCAQEAqTiu2kHp
27
+ 3/M00CM+FQcNuJYlIXnYAfQL+edVwV6icye1ltNWKrbdh1Agf1qFPwD52lnBbFVO
28
+ o64Og9S2xCX/usdfOAY22TL8RmuDaxWO4OqNZ12/SqGVtN20mxiWPVUtEa368MPE
29
+ 1E3H636binIQheXn07YzcJ83LsnQ3N3AtDDwrSba6DZDI6JbEz0FY6uiIRtNEfNK
30
+ cijARF2uZPGdOJjOjz/0F9dpYgplzzhn0adXJdevwS5QML5XMcPE5U9R/WvlhxHp
31
+ AJ2kmROiYBLscpVrfyHxtEJluJwbid/KyR/BybHL7uezZ2/EbCxCYanOIbNyctTp
32
+ CNgZvs+F41zO7g==
33
+ -----END CERTIFICATE-----
34
+ date: 2017-01-06 00:00:00.000000000 Z
35
+ dependencies:
36
+ - !ruby/object:Gem::Dependency
37
+ name: polyrex
38
+ requirement: !ruby/object:Gem::Requirement
39
+ requirements:
40
+ - - "~>"
41
+ - !ruby/object:Gem::Version
42
+ version: '1.1'
43
+ - - ">="
44
+ - !ruby/object:Gem::Version
45
+ version: 1.1.9
46
+ type: :runtime
47
+ prerelease: false
48
+ version_requirements: !ruby/object:Gem::Requirement
49
+ requirements:
50
+ - - "~>"
51
+ - !ruby/object:Gem::Version
52
+ version: '1.1'
53
+ - - ">="
54
+ - !ruby/object:Gem::Version
55
+ version: 1.1.9
56
+ description:
57
+ email: james@jamesrobertson.eu
58
+ executables: []
59
+ extensions: []
60
+ extra_rdoc_files: []
61
+ files:
62
+ - lib/pxgraphviz.rb
63
+ homepage: https://github.com/jrobertson/pxgraphviz
64
+ licenses:
65
+ - MIT
66
+ metadata: {}
67
+ post_install_message:
68
+ rdoc_options: []
69
+ require_paths:
70
+ - lib
71
+ required_ruby_version: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ required_rubygems_version: !ruby/object:Gem::Requirement
77
+ requirements:
78
+ - - ">="
79
+ - !ruby/object:Gem::Version
80
+ version: '0'
81
+ requirements: []
82
+ rubyforge_project:
83
+ rubygems_version: 2.6.8
84
+ signing_key:
85
+ specification_version: 4
86
+ summary: Generates a GraphViz Markup Language file from a Polyrex document
87
+ test_files: []
metadata.gz.sig ADDED
Binary file