mementus 0.3.2 → 0.3.3
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/mementus/pipeline.rb +21 -2
- data/lib/mementus/version.rb +1 -1
- data/mementus.gemspec +2 -2
- data/spec/pipeline_spec.rb +8 -2
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 13343725a3e1defe38d65c9938c53a95755d223b
|
4
|
+
data.tar.gz: 683c929e1e9cc54529498afefb199c005a75868f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 854588aedd67735d623bd05e92107b7ace162ebe81690f32cb35110316894f0e320b38eb4845ca620dfa7e3013398c0711ab10ee9df09f31cb92a81d502e65e2
|
7
|
+
data.tar.gz: b0290808513880dba332a7c5f59c2471a0a11177d7bbe48d7ef6eab97fd295eacf157817e5ddb22e704e7c572fca9b2d8da7ad8981d4d8d627e504e9e5cab9ed
|
data/lib/mementus/pipeline.rb
CHANGED
@@ -36,7 +36,12 @@ module Mementus
|
|
36
36
|
end
|
37
37
|
|
38
38
|
def out
|
39
|
-
append_next(Pipes::
|
39
|
+
append_next(Pipes::Outgoing.new)
|
40
|
+
self
|
41
|
+
end
|
42
|
+
|
43
|
+
def in
|
44
|
+
append_next(Pipes::Incoming.new)
|
40
45
|
self
|
41
46
|
end
|
42
47
|
end
|
@@ -52,12 +57,26 @@ module Mementus
|
|
52
57
|
end
|
53
58
|
end
|
54
59
|
|
55
|
-
class
|
60
|
+
class Outgoing
|
56
61
|
def process(graph, node)
|
57
62
|
graph.each_adjacent(node.id).map do |id|
|
58
63
|
Mementus::NodeProxy.new(id, graph)
|
59
64
|
end
|
60
65
|
end
|
61
66
|
end
|
67
|
+
|
68
|
+
class Incoming
|
69
|
+
def process(graph, node)
|
70
|
+
incoming = []
|
71
|
+
|
72
|
+
graph.each_node do |n|
|
73
|
+
graph.each_adjacent(n.id) do |id|
|
74
|
+
incoming << Mementus::NodeProxy.new(n.id, graph) if id == node.id
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
78
|
+
incoming
|
79
|
+
end
|
80
|
+
end
|
62
81
|
end
|
63
82
|
end
|
data/lib/mementus/version.rb
CHANGED
data/mementus.gemspec
CHANGED
@@ -8,8 +8,8 @@ Gem::Specification.new do |spec|
|
|
8
8
|
spec.version = Mementus::VERSION
|
9
9
|
spec.authors = ["maetl"]
|
10
10
|
spec.email = ["me@maetl.net"]
|
11
|
-
spec.description =
|
12
|
-
spec.summary =
|
11
|
+
spec.description = "Graph data structure toolkit."
|
12
|
+
spec.summary = "Graph data structure toolkit for Ruby applications."
|
13
13
|
spec.homepage = "https://github.com/maetl/mementus"
|
14
14
|
spec.license = "MIT"
|
15
15
|
|
data/spec/pipeline_spec.rb
CHANGED
@@ -22,15 +22,21 @@ describe 'pipeline api' do
|
|
22
22
|
end
|
23
23
|
end
|
24
24
|
|
25
|
-
it '
|
25
|
+
it 'traverses from the given node' do
|
26
26
|
pipeline = graph.n(1)
|
27
27
|
expect(pipeline.id).to eq(1)
|
28
28
|
expect(pipeline.one.id).to eq(1)
|
29
29
|
end
|
30
30
|
|
31
|
-
it 'traverses to
|
31
|
+
it 'traverses to outgoing nodes' do
|
32
32
|
pipeline = graph.n(1).out
|
33
33
|
expect(pipeline.all.count).to eq(1)
|
34
34
|
expect(pipeline.all.first.id).to eq(2)
|
35
35
|
end
|
36
|
+
|
37
|
+
it 'traverses to incoming nodes' do
|
38
|
+
pipeline = graph.n(2).in
|
39
|
+
expect(pipeline.all.count).to eq(1)
|
40
|
+
expect(pipeline.all.first.id).to eq(1)
|
41
|
+
end
|
36
42
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mementus
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- maetl
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-06-
|
11
|
+
date: 2016-06-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -52,7 +52,7 @@ dependencies:
|
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '3.4'
|
55
|
-
description:
|
55
|
+
description: Graph data structure toolkit.
|
56
56
|
email:
|
57
57
|
- me@maetl.net
|
58
58
|
executables: []
|
@@ -116,7 +116,7 @@ rubyforge_project:
|
|
116
116
|
rubygems_version: 2.4.5
|
117
117
|
signing_key:
|
118
118
|
specification_version: 4
|
119
|
-
summary:
|
119
|
+
summary: Graph data structure toolkit for Ruby applications.
|
120
120
|
test_files:
|
121
121
|
- spec/direction_spec.rb
|
122
122
|
- spec/graph_spec.rb
|