graphvizml 0.1.1 → 0.1.2

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: a84a1276df50dc9b3a42270b850788371e1df56f
4
- data.tar.gz: 12a0d9aa6cbec9f3c0e9024ef465cb1395267384
3
+ metadata.gz: f5d3e64a89e4a8aca44de4b73ee8fdd67654f654
4
+ data.tar.gz: 9bbf22a678f88328434bee2d25dab96f67c42de7
5
5
  SHA512:
6
- metadata.gz: 637263f335a6ebc06ae46254dc8fd73d0ab1d5fb6c0df063a74738c39b1de0a5ff8b3a0fdfce6c65b7f162237ee2c2aba123df54ee23eb22cb79488af8117689
7
- data.tar.gz: 2bcd59169b7b96b5a9408a7188ea689e67c90df09a4c9591373a1d4c754d35078338668bcf5fd9485189105a9f42df8ab6114293705d894187cc50dd3c4a5f97
6
+ metadata.gz: 6eb862a9595478d7561ad7aa3d59af7128c3f6b98623b78d8348c8550606c3825d5f85198af44ddf0a10fb4746aa793d6f84697bb4a9a672b1a051af013937d6
7
+ data.tar.gz: 243962484ebc442197d35be82b8b2191ba00de9f0cf1c9f148597cf5d8cb051c3c34b524775ef9ce947a2bc370f4c947ae950b8438ebc5cac7f6244364cf09ef
checksums.yaml.gz.sig CHANGED
Binary file
data.tar.gz.sig CHANGED
Binary file
data/lib/graphvizml.rb CHANGED
@@ -9,12 +9,22 @@ require 'graphviz' # this loads the ruby-graphviz gem
9
9
  class GraphVizML
10
10
 
11
11
 
12
- def initialize(filename)
12
+ def initialize(obj)
13
13
 
14
14
  @g = GraphViz::new( "structs", "type" => "graph" )
15
15
  @g[:rankdir] = "LR"
16
- @filename = filename
17
- @doc = Rexle.new(File.read filename)
16
+
17
+ if obj.is_a? String then
18
+
19
+ @filename = obj
20
+ @doc = Rexle.new(File.read @filename)
21
+
22
+ elsif obj.is_a? Rexle
23
+
24
+ @filename = 'gvml.xml'
25
+ @doc = obj
26
+
27
+ end
18
28
 
19
29
  end
20
30
 
@@ -24,7 +34,6 @@ class GraphVizML
24
34
  e_nodes = @doc.root.element 'nodes'
25
35
  e_edges = @doc.root.element 'edges'
26
36
 
27
-
28
37
  # set global node options
29
38
 
30
39
  xpath_node = "records/option[summary/type='node']/records/attribute"
@@ -46,6 +55,7 @@ class GraphVizML
46
55
  # add the edges
47
56
 
48
57
  e_edges.root.xpath('records/edge').each do |edge|
58
+
49
59
  a = edge.xpath('records/node')
50
60
  @g.add_edge(a[0].attribute('id').to_s,
51
61
  a[1].attribute('id').to_s).label = edge.text('summary/label').to_s
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.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Robertson
metadata.gz.sig CHANGED
Binary file