pxgraphviz 0.3.1 → 0.3.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 72179d92484b8c9ad2b836a2f8ac34720731be22
4
- data.tar.gz: 598aea1e17db4d51e5750438279ba3609e6a269a
3
+ metadata.gz: 27c3f2f1504c7444b8596d9bd40583f1fb93de37
4
+ data.tar.gz: 56ba3b46055481b052d4f4bd615c973ce00f58a6
5
5
  SHA512:
6
- metadata.gz: 0b9f235c3c6867acb21efa2e13471f7a3ccc913cb9111ef8cab51c447226ea49c7de66695b72eaad4569435b5029c184ef657d95ecf340a2fa243825467fd03b
7
- data.tar.gz: ad52686ffc91256ba8ef41aa89bf2c7069c80a6fb335d8c9c5b958df3cd8cf838c002a2db47f9fe235f3485e6503ec8fffabd8081ec9faf8e72b11ea073ec722
6
+ metadata.gz: be2189e968e851619cfd212fb708b1272eac96a0384fcbb52dd363990b16baa34d8da94a01301268ce402346199d0136b9bea09434fbcc268e83a27b635c2314
7
+ data.tar.gz: 8fb6c154726548318339ae7196b67942eea25277f799a01680a0c20e347bfa5f1fd9a803f1abbfb7c11c01343a67e0346c60472ba950b96c801189809bfed6bf
checksums.yaml.gz.sig CHANGED
Binary file
data.tar.gz.sig CHANGED
@@ -1 +1,2 @@
1
- ���/-0��{}Ֆ���2N�? Ba9��=ؕ��w���;����x?! �M<.��.^j0h !�=�(���.�x�–�_���~BZ3��3 �Y�������~���c��FI�B<���i���+�%��8���|v����o����(@�M��D�L:�G5�����i���ݦ�t'��s��ކo��doߵ}jV�H�� ��^��?�0
1
+ 3��%�æa���a^m��I��-����*�҆#�F���0S������7]moZxc`?��Ķ d���g�m ��v[>���Z�/�2����7̈́��Ydc���kO]Z�<;�j�%Dz���ڔ���w�]����L4�1*��%�5�3̢��5!�� ���O
2
+ 0L���E�Pvz�J�(8��C'��S�D�j�^=Q�����ԍ���A�Ѐ̫�k��2j _�'�n���ዘ���;g��i�}��9��y�
data/lib/pxgraphviz.rb CHANGED
@@ -10,19 +10,10 @@ require 'graphvizml'
10
10
  class PxGraphViz
11
11
 
12
12
 
13
- def initialize(s)
13
+ def initialize(s, style: default_stylesheet())
14
14
 
15
- if s =~ /^<\?/ then
16
-
17
- px = Polyrex.new
18
- px.import s
19
-
20
- else
21
- px = Polyrex.new s
22
-
23
- end
24
-
25
- @doc = build(px)
15
+ px = s =~ /^<\?/ ? Polyrex.new.import(s) : Polyrex.new(s)
16
+ @doc = build(px, style)
26
17
 
27
18
  end
28
19
 
@@ -51,7 +42,7 @@ class PxGraphViz
51
42
 
52
43
  private
53
44
 
54
- def build(px)
45
+ def build(px, style)
55
46
 
56
47
  # The issue with 2 nodes having the same name has yet to be rectified
57
48
  #jr020917 labels = @px.xpath('//records/item/summary/label/text()').uniq
@@ -117,13 +108,35 @@ class PxGraphViz
117
108
  end
118
109
  end
119
110
 
111
+ end
112
+
113
+
114
+ h = {
115
+ style: style,
116
+ nodes: {summary: '', records: node_records[3..-1]},
117
+ edges: {summary: '', records: edge_records[3..-1]}
118
+ }
119
+
120
+ a = RexleBuilder.new(h).to_a
121
+ a[0] = 'gvml'
122
+
123
+ summary = px.summary.to_h
124
+ %i(recordx_type format_mask schema).each do |x|
125
+ summary.delete x; summary.delete x.to_s
120
126
  end
121
127
 
122
-
123
- style =<<STYLE
128
+ a[1] = summary
129
+
130
+ Rexle.new(a)
131
+
132
+ end
133
+
134
+ def default_stylesheet()
135
+
136
+ <<STYLE
124
137
  node {
125
138
  color: #ddaa66;
126
- fillcolor: #775500;
139
+ fillcolor: #775533;
127
140
  fontcolor: #ffeecc;
128
141
  fontname: Trebuchet MS;
129
142
  fontsize: 8;
@@ -142,23 +155,6 @@ style =<<STYLE
142
155
  weight: 1;
143
156
  }
144
157
  STYLE
145
- h = {
146
- style: style,
147
- nodes: {summary: '', records: node_records[3..-1]},
148
- edges: {summary: '', records: edge_records[3..-1]}
149
- }
150
-
151
- a = RexleBuilder.new(h).to_a
152
- a[0] = 'gvml'
153
-
154
- summary = px.summary.to_h
155
- %i(recordx_type format_mask schema).each do |x|
156
- summary.delete x; summary.delete x.to_s
157
- end
158
-
159
- a[1] = summary
160
-
161
- Rexle.new(a)
162
158
 
163
159
  end
164
160
 
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.3.1
4
+ version: 0.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Robertson
metadata.gz.sig CHANGED
Binary file