mementus 0.2.1 → 0.2.2

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: a4a89d482eebdd901269f7a93501a22883a3b084
4
- data.tar.gz: 571323b9865fb729fc2a8b63e70d727a5108a90f
3
+ metadata.gz: 26dd9d077d7ad9d1747b4071a91db233131dbba3
4
+ data.tar.gz: d04e4c35b6eca0c45640cb06ba0136ab08b2453a
5
5
  SHA512:
6
- metadata.gz: 8182797b06e55efe935305ec6067007ae569adbf90ceac25aaf2b990a74495bf64597efd023f24be7d8f6e5ce8bfb59b77da8de666454a7f3f5fdb018c49c42d
7
- data.tar.gz: 9151ad44dbcc2570de6e58d60e5e967de8c4ce1ae9441795a63f37ae8bac8ca64cbf1596a15d5a277635fd15b135ae08f3596e4253c5297dcedc63e502bec6da
6
+ metadata.gz: 9cf713cbafc0edd0df14e241a7c7b328948eeac489146ce96d3849fd52ffb8a75fb9f124b78beaec5828d3485a5b09099c9452bbc60a26637b67f8f30edea528
7
+ data.tar.gz: 6541ecd1725179928a9dc9c6cdafe0df633222da04bff157e5b63dc3aa0b30699ce84bdcc6a14e75a0c6afef95d6b4ea9e7bfb59beca86f2954e67f9e524c13b
@@ -41,6 +41,14 @@ module Mementus
41
41
  has_node?(edge.from) && @index[edge.from].include?(edge.to)
42
42
  end
43
43
 
44
+ def node(id)
45
+ @index.keys.find { |node| node.id == id }
46
+ end
47
+
48
+ def nodes
49
+ @index.keys
50
+ end
51
+
44
52
  def each_node(&blk)
45
53
  @index.each_key(&blk)
46
54
  end
@@ -1,3 +1,3 @@
1
1
  module Mementus
2
- VERSION = '0.2.1'.freeze
2
+ VERSION = '0.2.2'.freeze
3
3
  end
@@ -19,6 +19,6 @@ Gem::Specification.new do |spec|
19
19
  spec.require_paths = ["lib"]
20
20
 
21
21
  spec.add_development_dependency "bundler", "~> 1.3"
22
- spec.add_development_dependency "rake"
23
- spec.add_development_dependency "rspec"
22
+ spec.add_development_dependency "rake", "~> 11.1"
23
+ spec.add_development_dependency "rspec", "~> 3.4"
24
24
  end
@@ -42,4 +42,20 @@ describe Mementus::Graph do
42
42
  expect(graph.has_edge?(edge)).to be true
43
43
  expect(graph.has_edge?(edge2)).to be false
44
44
  end
45
+
46
+ specify '#node(id)' do
47
+ graph = Mementus::Graph.new
48
+ edge = Mementus::Edge.new(Mementus::Node.new(1, :node), Mementus::Node.new(2, :node))
49
+ graph.add_edge(edge)
50
+
51
+ expect(graph.node(1)).to eq(edge.from)
52
+ end
53
+
54
+ specify '#nodes(filter)' do
55
+ graph = Mementus::Graph.new
56
+ edge = Mementus::Edge.new(Mementus::Node.new(1, :node), Mementus::Node.new(2, :node))
57
+ graph.add_edge(edge)
58
+
59
+ expect(graph.nodes).to eq([edge.from, edge.to])
60
+ end
45
61
  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.2.1
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - maetl
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-03-26 00:00:00.000000000 Z
11
+ date: 2016-03-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -28,30 +28,30 @@ dependencies:
28
28
  name: rake
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ">="
31
+ - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '0'
33
+ version: '11.1'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ">="
38
+ - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '0'
40
+ version: '11.1'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rspec
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - ">="
45
+ - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: '0'
47
+ version: '3.4'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - ">="
52
+ - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: '0'
54
+ version: '3.4'
55
55
  description: In-memory data model
56
56
  email:
57
57
  - me@maetl.net
@@ -66,7 +66,6 @@ files:
66
66
  - README.md
67
67
  - Rakefile
68
68
  - lib/mementus.rb
69
- - lib/mementus/adapter.rb
70
69
  - lib/mementus/breadth_first_search.rb
71
70
  - lib/mementus/depth_first_search.rb
72
71
  - lib/mementus/edge.rb
@@ -1,10 +0,0 @@
1
- module Axiom
2
- module Adapter
3
- class Memory
4
- # Patch for missing hash check in Axiom memory adapter
5
- def has_key?(key)
6
- schema.has_key?(key)
7
- end
8
- end
9
- end
10
- end