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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 51576e4f06689d15c0f10ecc7543bbf2135b7aa2
4
- data.tar.gz: 8c681b2e0747301acb9febb7c15bc45b4fd1fedd
3
+ metadata.gz: c2d345ed84736981e0ea78702dc9530538d20161
4
+ data.tar.gz: 2bce7c3662db759957bb7187f59a166c40c89e7e
5
5
  SHA512:
6
- metadata.gz: 20fbeee9ae1f0abff80637fb97214c6366899c7d9788ef74e0fd2e1a5e6d9015b449e71d8168223e73abef598ae3dd29a651aea5d19c4ad6b77c4b62ea2bb269
7
- data.tar.gz: 82587fa758d97b6217950ca795a4d557b020117d9d35251a042547ed1eed85e53beb92747bd0a18c5a8ea734aaf5d94d6674372d4fa48a602e12eef542f49bd8
6
+ metadata.gz: 2c20965789119478aef278ed46cb9db1c0105cbb1d3f3708bc35b83fd7481a4f107cf5d7ffffeea662182f051239e922cf028e5a1024606d891d8b87567e4a19
7
+ data.tar.gz: 6d70a0d20723783667bfdc3d48b0cdea4b30debd9b5362dc3c5c51b5064bf1bc3a1dac8db6925bcaebaeb00ff2bc7cb179f6c5c59aed4baef15863d47363bbed
@@ -52,6 +52,10 @@ module Mementus
52
52
  @structure.nodes(match)
53
53
  end
54
54
 
55
+ def edges(match=nil)
56
+ @structure.edges(match)
57
+ end
58
+
55
59
  def outgoing(id, match=nil)
56
60
  @structure.adjacent(id, match)
57
61
  end
@@ -1,3 +1,3 @@
1
1
  module Mementus
2
- VERSION = '0.5.10'.freeze
2
+ VERSION = '0.5.11'.freeze
3
3
  end
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 '#nodes(filter)' do
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.10
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-12 00:00:00.000000000 Z
11
+ date: 2016-11-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler