mementus 0.8.1 → 0.8.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
- SHA1:
3
- metadata.gz: fae8986161bdb24824b5897e0f09b4b62e0d18ae
4
- data.tar.gz: 592ce7d666d1c5f7e9368716092b7158f22e1c91
2
+ SHA256:
3
+ metadata.gz: 223874927cc970ab0f6649817e5e43d2d8e95603df9bb26ac3a7b911ce3b8599
4
+ data.tar.gz: 5f9fc630c6bc787ba209be9696a1e0fb961e0a1deaf349d4912e56ea12bc2e65
5
5
  SHA512:
6
- metadata.gz: d5b5f9d0c563bc3173e45c6a88ba8b88769c8c8f504e78b28fe9823d4fc42207045b9cc169c66173bead90380e9fe3ac47ec17e9930911cb90eb8f9a3b1c0e8c
7
- data.tar.gz: 669cc8a2bf3dd25f0ecbfa6528c0ca806f4492f96081550b65243aed13b32133c2b266c48e12080f4b4190d36f8cfd1e18141ac937fb08b95565bfbc027eb39b
6
+ metadata.gz: 88591917460dd9a4ba48115741612b89553b3ec871b1e782aefbe471f7fa210f12c67f027f4d89e7e8dbe93739c4f20c699af635fbb89e7343a023eb3dac4143
7
+ data.tar.gz: d09e3a0b83523b5d4210802ecfd4f4001768ee596cbb53e626564d40580834673eb520931a189c3855f2a1e4845f406a483cbbc61d4a5a0b13ed648c955d88fc
@@ -6,6 +6,7 @@ require 'mementus/structure/adjacency_list'
6
6
  require 'mementus/structure/incidence_list'
7
7
  require 'mementus/node'
8
8
  require 'mementus/edge'
9
+ require 'mementus/criteria'
9
10
  require 'mementus/node_proxy'
10
11
  require 'mementus/edge_proxy'
11
12
  require 'mementus/pipeline/pipe'
@@ -52,7 +52,7 @@ module Mementus
52
52
  @structure.edge(id)
53
53
  end
54
54
 
55
- def nodes(match=nil)
55
+ def nodes(*match)
56
56
  @structure.nodes(match)
57
57
  end
58
58
 
@@ -34,7 +34,7 @@ module Mementus
34
34
  end
35
35
 
36
36
  def in_e(match=nil)
37
- Pipeline::Step.new([self], Pipeline::Pipe.new(@graph), @graph).in(match)
37
+ Pipeline::Step.new([self], Pipeline::Pipe.new(@graph), @graph).in_e(match)
38
38
  end
39
39
 
40
40
  def each_adjacent(&block)
@@ -74,19 +74,25 @@ module Mementus
74
74
  @nodes[id]
75
75
  end
76
76
 
77
- def nodes(match=nil)
78
- return @nodes.values unless match
77
+ def nodes(*match)
78
+ return @nodes.values if match.empty?
79
79
 
80
- if match.is_a?(Hash)
81
- @nodes.values.select do |node|
82
- key = match.first.first
83
- val = match.first.last
84
- node[key] == val
80
+ criteria = Mementus::Criteria.new(match)
81
+
82
+ @nodes.values.select do |node|
83
+ selected = false
84
+
85
+ if criteria.label
86
+ selected = node.label == criteria.label
85
87
  end
86
- elsif match.is_a?(Symbol)
87
- @nodes.values.select do |node|
88
- node.label == match
88
+
89
+ if criteria.props
90
+ key = criteria.props.first.first
91
+ val = criteria.props.first.last
92
+ selected = node[key] == val
89
93
  end
94
+
95
+ selected
90
96
  end
91
97
  end
92
98
 
@@ -1,3 +1,3 @@
1
1
  module Mementus
2
- VERSION = '0.8.1'.freeze
2
+ VERSION = '0.8.2'.freeze
3
3
  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.8.1
4
+ version: 0.8.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - maetl
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-01-30 00:00:00.000000000 Z
11
+ date: 2018-05-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -137,7 +137,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
137
137
  version: '0'
138
138
  requirements: []
139
139
  rubyforge_project:
140
- rubygems_version: 2.6.13
140
+ rubygems_version: 2.7.6
141
141
  signing_key:
142
142
  specification_version: 4
143
143
  summary: Graph data structure toolkit for Ruby applications.