mementus 0.5.10 → 0.5.11
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/mementus/graph.rb +4 -0
- data/lib/mementus/version.rb +1 -1
- data/spec/graph_spec.rb +40 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c2d345ed84736981e0ea78702dc9530538d20161
|
4
|
+
data.tar.gz: 2bce7c3662db759957bb7187f59a166c40c89e7e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2c20965789119478aef278ed46cb9db1c0105cbb1d3f3708bc35b83fd7481a4f107cf5d7ffffeea662182f051239e922cf028e5a1024606d891d8b87567e4a19
|
7
|
+
data.tar.gz: 6d70a0d20723783667bfdc3d48b0cdea4b30debd9b5362dc3c5c51b5064bf1bc3a1dac8db6925bcaebaeb00ff2bc7cb179f6c5c59aed4baef15863d47363bbed
|
data/lib/mementus/graph.rb
CHANGED
data/lib/mementus/version.rb
CHANGED
data/spec/graph_spec.rb
CHANGED
@@ -159,7 +159,16 @@ describe Mementus::Graph do
|
|
159
159
|
expect(graph.node(1).id).to eq(edge_1_2.from.id)
|
160
160
|
end
|
161
161
|
|
162
|
-
specify '#
|
162
|
+
specify '#edge(id)' do
|
163
|
+
graph = Mementus::Graph.new do
|
164
|
+
add_edge(id: 1, from: 1, to: 2)
|
165
|
+
end
|
166
|
+
|
167
|
+
expect(graph.edge(1).from.id).to eq(1)
|
168
|
+
expect(graph.edge(1).to.id).to eq(2)
|
169
|
+
end
|
170
|
+
|
171
|
+
specify '#nodes' do
|
163
172
|
graph = Mementus::Graph.new do
|
164
173
|
set_edge(edge_1_2)
|
165
174
|
end
|
@@ -167,4 +176,34 @@ describe Mementus::Graph do
|
|
167
176
|
expect(graph.nodes.first.id).to eq(edge_1_2.from.id)
|
168
177
|
expect(graph.nodes.last.id).to eq(edge_1_2.to.id)
|
169
178
|
end
|
179
|
+
|
180
|
+
specify '#nodes(filter)' do
|
181
|
+
graph = Mementus::Graph.new do
|
182
|
+
set_edge(edge_1_2)
|
183
|
+
add_node(id: 3, label: :checked)
|
184
|
+
add_node(id: 4, label: :checked)
|
185
|
+
end
|
186
|
+
|
187
|
+
expect(graph.nodes(:checked).first.id).to eq(3)
|
188
|
+
expect(graph.nodes(:checked).last.id).to eq(4)
|
189
|
+
end
|
190
|
+
|
191
|
+
specify '#edges' do
|
192
|
+
graph = Mementus::Graph.new do
|
193
|
+
add_edge(id: 1, from: 1, to: 2)
|
194
|
+
add_edge(id: 2, from: 3, to: 4)
|
195
|
+
end
|
196
|
+
|
197
|
+
expect(graph.edges.first.id).to eq(1)
|
198
|
+
expect(graph.edges.last.id).to eq(2)
|
199
|
+
end
|
200
|
+
|
201
|
+
specify '#edges' do
|
202
|
+
graph = Mementus::Graph.new do
|
203
|
+
add_edge(id: 1, from: 1, to: 2)
|
204
|
+
add_edge(id: 2, from: 3, to: 4, label: :checked)
|
205
|
+
end
|
206
|
+
|
207
|
+
expect(graph.edges(:checked).first.id).to eq(2)
|
208
|
+
end
|
170
209
|
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.5.
|
4
|
+
version: 0.5.11
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- maetl
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-11-
|
11
|
+
date: 2016-11-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|