dogviz 0.0.9 → 0.0.10

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: ccbe6d7d9874501b08c7cf43ea6a1e49b95d8cca
4
- data.tar.gz: 09b487a66ff024a597c1afc6aafe0107af7710d5
3
+ metadata.gz: cc41dd5fb565570c0542f852fe798a3c33bd0e92
4
+ data.tar.gz: 3561e4fe3f217a3a8939de36377d0a32a0ad36da
5
5
  SHA512:
6
- metadata.gz: 2f87845958188d5eded22c201d4858c6c7c0c390092bbe975ffe788827d5a45ae3296ae84af5d74fc8fb12bccf97c609ea7ae803a846f3a14051885f1fccefd5
7
- data.tar.gz: fe666f3a5bc5474eed94511c2d75830236605a848b8cad6379920f0414737b2ec12f22ca0224cc9a47269623d64fcd2e6baebd897d780cb0e6076a937cf3af3b
6
+ metadata.gz: ad9a6fe72533c4687e2cbfab4ba6cf582d2a3680890258707a13c4458bfb894a0bc6a9572b4685c23e8c351d36de78fa9069780a66cc531e541fee06abfb220b
7
+ data.tar.gz: eed194cd2f1540ab35d25ef23cb41fc3ccfc5cda34f55f84c58a8709be5a440c1faa4a641029ed850dfa49c7839a6143fbee8f922935bc5c34236c72540a5c61
@@ -1,3 +1,3 @@
1
1
  module Dogviz
2
- VERSION = '0.0.9'
3
- end
2
+ VERSION = '0.0.10'
3
+ end
data/lib/dogviz.rb CHANGED
@@ -19,9 +19,20 @@ module Dogviz
19
19
  end
20
20
  ancestors
21
21
  end
22
+ def info(fields)
23
+ @info.merge! fields
24
+ setup_render_attributes(label: label_with_info)
25
+ end
22
26
  def doclink(url)
23
27
  setup_render_attributes(URL: url)
24
28
  end
29
+ def label_with_info
30
+ lines = [ name ]
31
+ @info.each {|k, v|
32
+ lines << "#{k}: #{v}"
33
+ }
34
+ lines.join "\n"
35
+ end
25
36
  def setup_render_attributes(attributes)
26
37
  @attributes = {} if @attributes.nil?
27
38
  @attributes.merge!(attributes)
@@ -103,6 +114,7 @@ module Dogviz
103
114
  @pointers = []
104
115
  @rollup = false
105
116
  @skip = false
117
+ @info = {}
106
118
  @edge_heads = []
107
119
 
108
120
  rollup! if options[:rollup]
@@ -215,6 +227,7 @@ module Dogviz
215
227
  @name = name
216
228
  @id = create_id(name, parent)
217
229
  @skip = false
230
+ @info = {}
218
231
 
219
232
  init_rollup options
220
233
 
@@ -321,6 +321,14 @@ class TestDogvizGraphvizRendering < Test::Unit::TestCase
321
321
  assert_equal(doc_url, find('a')['URL'].to_ruby)
322
322
  end
323
323
 
324
+ def test_info_rendered_into_label
325
+ a = sys.thing('a')
326
+ a.info(ip: '1.1.1.1')
327
+
328
+ assert_equal('a', a.name)
329
+ assert_equal('"a\nip: 1.1.1.1"', find('a')['label'].to_ruby)
330
+ end
331
+
324
332
  private
325
333
 
326
334
  def subgraph_ids
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dogviz
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.9
4
+ version: 0.0.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - damned
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-03-08 00:00:00.000000000 Z
11
+ date: 2016-03-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler