kvdag 0.1.3 → 0.1.4
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
- checksums.yaml.gz.sig +0 -0
- data/lib/kvdag/version.rb +1 -1
- data/lib/kvdag/vertex.rb +35 -14
- data.tar.gz.sig +2 -2
- metadata +2 -2
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 06c11321672d83aaba22773e16dca33815acf1ea
|
4
|
+
data.tar.gz: fc8aa8adacf2bdeee1ffd349457acebb49d9a434
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 42d6fe8ecbdfe931d9c77cc61a0dbc1b7758b9fb4a4556b01efc378121ecbd45f4169db056de5dae1e73509665c9f08eac5b492c3ba3a71a0be1eb9843f402ef
|
7
|
+
data.tar.gz: fae41ebe8ae35a475d912883b64a99a777993d351b75ae7e5c90286360e328fe53d88a696d2c7bba2a388ef085a70be845fee5b81b799b36e23566a5743cfd57
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data/lib/kvdag/version.rb
CHANGED
data/lib/kvdag/vertex.rb
CHANGED
@@ -92,27 +92,48 @@ class KVDAG
|
|
92
92
|
other.reachable?(self)
|
93
93
|
end
|
94
94
|
|
95
|
-
#
|
96
|
-
#
|
95
|
+
# :call-seq:
|
96
|
+
# vtx.ancestors -> all ancestors
|
97
|
+
# vtx.ancestors(filter) -> ancestors matching +filter+
|
98
|
+
# vtx.ancestors {|anc| ... } -> call block with each ancestor
|
97
99
|
#
|
98
|
-
#
|
100
|
+
# Return the set of this object and all its parents, and their
|
101
|
+
# parents, recursively, possibly filtered by #match?
|
102
|
+
# expressions. If a block is given, call it with each ancestor.
|
99
103
|
|
104
|
+
def ancestors(filter={}, &block)
|
105
|
+
result = Set.new
|
106
|
+
result << self if match?(filter)
|
100
107
|
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
108
|
+
parents.each {|p| result += p.ancestors(filter) }
|
109
|
+
|
110
|
+
if block_given?
|
111
|
+
result.each(&block)
|
112
|
+
else
|
113
|
+
result
|
114
|
+
end
|
105
115
|
end
|
106
116
|
|
107
|
-
#
|
108
|
-
#
|
117
|
+
# :call-seq:
|
118
|
+
# vtx.descendants -> all descendants
|
119
|
+
# vtx.descendants(filter) -> descendants matching +filter+
|
120
|
+
# vtx.descendants {|desc| ... } -> call block with each descendant
|
109
121
|
#
|
110
|
-
#
|
122
|
+
# Return the set of this object and all its children, and their
|
123
|
+
# children, recursively, possibly filtered by #match?
|
124
|
+
# expressions. If a block is given, call it with each descendant.
|
125
|
+
|
126
|
+
def descendants(filter={}, &block)
|
127
|
+
result = Set.new
|
128
|
+
result << self if match?(filter)
|
111
129
|
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
130
|
+
children.each {|c| result += c.descendants(filter) }
|
131
|
+
|
132
|
+
if block_given?
|
133
|
+
result.each(&block)
|
134
|
+
else
|
135
|
+
result
|
136
|
+
end
|
116
137
|
end
|
117
138
|
|
118
139
|
# Comparable ordering for a DAG:
|
data.tar.gz.sig
CHANGED
@@ -1,2 +1,2 @@
|
|
1
|
-
|
2
|
-
�
|
1
|
+
#��hb^���<�'G�����!�A���*�+��q��Q�QӉ��dxX��fu��>���z��a(IGLg%x�+����V�q��U��ӊ��
|
2
|
+
�6���zP��0n{��i@���y�P~���}�R-���)���̟_clc鑩�4��Q,�Є���|0�)F��*�uGҐ�Gg8��a�ȵ��Ŗ� x�l��I����9��K����)����0?������ñ�+��xT���9�Q��{9�Đ3ԛt�˙��wD
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kvdag
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Calle Englund
|
@@ -31,7 +31,7 @@ cert_chain:
|
|
31
31
|
f8wtQllq82VF0AXUYeLtTh1f+DW3WW5BO1e2OCu5eOV7dbyaVPaNK/+rHjCN8kM/
|
32
32
|
DGZSwUoNADmVkQ==
|
33
33
|
-----END CERTIFICATE-----
|
34
|
-
date: 2016-11-
|
34
|
+
date: 2016-11-18 00:00:00.000000000 Z
|
35
35
|
dependencies:
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: activesupport
|
metadata.gz.sig
CHANGED
Binary file
|