dogviz 0.0.11 → 0.0.12
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 +4 -4
- data/lib/dogviz/version.rb +1 -1
- data/lib/dogviz.rb +17 -7
- data/tests/test_dogviz_graph.rb +13 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f085fb8d6ded2540d50008da16c1c6d6769d5041
|
4
|
+
data.tar.gz: f98a92c101a882b59863dd073dd8349c29141ba3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7cd88dfa88063c39f4ffa14e017bcc34da8faf484bd283e587242391780c5c9030ef3a9aabe7c58e1f6de56d2266a7ccfb93fa0630781946e21d5c3fea798181
|
7
|
+
data.tar.gz: 80784c272449229635d3b99b7fb348e8d3dc61a4524ab39c27080751a17a4fe60c28bd0ebc6b1d476c929f87f1d2c615e73293e8ca01240e2855f716baf2f3a2
|
data/lib/dogviz/version.rb
CHANGED
data/lib/dogviz.rb
CHANGED
@@ -15,6 +15,21 @@ module Dogviz
|
|
15
15
|
Process.new(self, action)
|
16
16
|
end
|
17
17
|
end
|
18
|
+
module Nominator
|
19
|
+
def nominate(names_to_nominees)
|
20
|
+
names_to_nominees.each {|name, nominee|
|
21
|
+
self.class.send(:define_method, name) do
|
22
|
+
nominee
|
23
|
+
end
|
24
|
+
}
|
25
|
+
end
|
26
|
+
def nominate_from(nominee_nominator, *nominee_names)
|
27
|
+
nominee_names.each {|name|
|
28
|
+
accessor_sym = name.to_s.to_sym
|
29
|
+
nominate accessor_sym => nominee_nominator.send(accessor_sym)
|
30
|
+
}
|
31
|
+
end
|
32
|
+
end
|
18
33
|
module Common
|
19
34
|
def create_id(name, parent)
|
20
35
|
parts = []
|
@@ -86,13 +101,6 @@ module Dogviz
|
|
86
101
|
end
|
87
102
|
end
|
88
103
|
module Parent
|
89
|
-
def nominate(names_to_values)
|
90
|
-
names_to_values.each {|name, value|
|
91
|
-
self.class.send(:define_method, name) do
|
92
|
-
value
|
93
|
-
end
|
94
|
-
}
|
95
|
-
end
|
96
104
|
def find_all(&matcher)
|
97
105
|
raise MissingMatchBlockError.new unless block_given?
|
98
106
|
@by_name.find_all &matcher
|
@@ -125,6 +133,7 @@ module Dogviz
|
|
125
133
|
|
126
134
|
class Thing
|
127
135
|
include Common
|
136
|
+
include Nominator
|
128
137
|
include Flowable
|
129
138
|
attr_reader :parent
|
130
139
|
attr_reader :name, :id, :pointers, :edge_heads
|
@@ -238,6 +247,7 @@ module Dogviz
|
|
238
247
|
|
239
248
|
class Container
|
240
249
|
include Common
|
250
|
+
include Nominator
|
241
251
|
include Parent
|
242
252
|
attr_reader :parent
|
243
253
|
attr_reader :name, :id, :node, :render_id, :render_type, :render_options, :children
|
data/tests/test_dogviz_graph.rb
CHANGED
@@ -127,6 +127,19 @@ class TestDogvizGraph < Test::Unit::TestCase
|
|
127
127
|
assert_equal dog, group.dog
|
128
128
|
end
|
129
129
|
|
130
|
+
def test_nominate_from_delegates_multiple_accessors
|
131
|
+
outer = sys.group('outer')
|
132
|
+
nested = outer.group('nested')
|
133
|
+
a = nested.thing('a')
|
134
|
+
b = nested.thing('b')
|
135
|
+
nested.nominate a: a, b: b
|
136
|
+
|
137
|
+
outer.nominate_from nested, 'a', :b
|
138
|
+
|
139
|
+
assert_equal a, outer.a
|
140
|
+
assert_equal b, outer.b
|
141
|
+
end
|
142
|
+
|
130
143
|
def test_root
|
131
144
|
group = sys.group('g')
|
132
145
|
nested_group = group.group('nested group')
|