graphvizml 0.5.0 → 0.5.1

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: b4bdf526de42c11fc8ce95cae6fb00ab33da0060
4
- data.tar.gz: 95bbde7cc050c1505f6da0d1d88a115f4e12b587
3
+ metadata.gz: 2c651777619a2a1e676faa7364eeb918fc3dba62
4
+ data.tar.gz: 0d265817fc9cb78ec24090161d52e31315a66868
5
5
  SHA512:
6
- metadata.gz: 660a430841c9c74ee2a96c5d0c710368339fab5af3233337d8777040ce852eaec9addccae47558a0ad253f9563a175c625e4a73f54c92608eacb93cc30d373a8
7
- data.tar.gz: 7446bdea1e72372999a5011fc3197ee8347689cb561953b06d105a2265316528b594b79c32b8723bc10f840dc071cce302369237d8271884fffca0d343a3899a
6
+ metadata.gz: 9af305f197c59e3e3a4526ae30ff77f9dc621c5b87d23ee6ddb036cb866face1ab696b80ad284532153427f37f4452c0de52c1a0e3268ab75de4feaefb736b5d
7
+ data.tar.gz: 9c438d8387c6a2b0e14109e8c83dfc733dab92f7157348e8f0a254d3bc3deb437ba8573b4b0e6aa023b7d30775783ffd1632a83b1b1b90594c20bcad725d98a0
checksums.yaml.gz.sig CHANGED
Binary file
data.tar.gz.sig CHANGED
Binary file
data/lib/graphvizml.rb CHANGED
@@ -67,9 +67,8 @@ class GraphVizML
67
67
  e_nodes = @doc.root.element 'nodes'
68
68
  e_edges = @doc.root.element 'edges'
69
69
 
70
- # add the nodes
71
70
 
72
- nodes = {}
71
+ # add the nodes
73
72
 
74
73
  nodes = e_nodes.root.xpath('records/node').inject({}) do |r,node|
75
74
 
@@ -98,20 +97,30 @@ class GraphVizML
98
97
  #puts "adding edge id1: %s id2: %s label: %s" % [id1, id2, label]
99
98
  nodes[id2][-1] ||= nodes[id1].last.add_node(nodes[id2][0])
100
99
  attributes = edge.style.merge({label: label})
100
+
101
101
  conn = nodes[id1][-1].connections.last
102
102
  conn.attributes[:label] = label
103
- edge.style.each {|key,val| conn.attributes[key] = val }
103
+ edge.style.each {|key,val| conn.attributes[key] = m(val) }
104
104
 
105
105
  end
106
106
 
107
107
  nodes.each do |id, x|
108
108
 
109
109
  _, attributes, obj = x
110
- attributes.each {|key, value| obj.attributes[key] = value }
110
+ attributes.each {|key, val| obj.attributes[key] = m(val) }
111
111
 
112
112
  end
113
113
 
114
114
  :build
115
115
  end
116
116
 
117
+ # modify the value if it matches the following criteria
118
+ #
119
+ def m(s)
120
+
121
+ # is it a shorthand hexcode? e.g. #fff
122
+ s.gsub(/^#([\da-f]{3})$/)\
123
+ { '#' + ($1).chars.inject([]) {|r,x| r << x + x}.join}
124
+ end
125
+
117
126
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: graphvizml
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Robertson
@@ -31,7 +31,7 @@ cert_chain:
31
31
  0fBBWVqwHyWs77T9gCuDZmQrw2NmfyhNWhBw0iljBXo7WLDNB3x0nP6mYTzk47O8
32
32
  sL5FGYJNgQqFlw==
33
33
  -----END CERTIFICATE-----
34
- date: 2017-09-05 00:00:00.000000000 Z
34
+ date: 2017-09-07 00:00:00.000000000 Z
35
35
  dependencies:
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: domle
metadata.gz.sig CHANGED
Binary file