activegraph 11.1.0.alpha.4 → 11.1.0.beta.1

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
  SHA256:
3
- metadata.gz: 314c68d13c5f37c277a4a53b84f58dd054ae5d2be176e8e575dc92a44099124f
4
- data.tar.gz: 36e153d37023168ac51a7f6f1b26854c3588fa7394f796f04720fedf619d601e
3
+ metadata.gz: 4aade7db7557b1222b78e048550606354b0707a60c9375359a4f945b702763c2
4
+ data.tar.gz: a22b396cdc491118ecbaf947ac9e00d9ea088fe0df5afa51a3a38b7f085db9ff
5
5
  SHA512:
6
- metadata.gz: 7487ba2280bab3230701541f00da5133af8ab6760454a58fdf06c2ff20340a14734577b026a1dffe232c75248b3cd821ebea42a9fbd4c581a3ef5e296c1a2d1f
7
- data.tar.gz: 4f03ea6939f779b78c3cb0141d50553894d4b2baf98f408ecc3f3cb91098b7df64abe577fe8586283cb499de6c4fa674a8f4c756388f5df64c08887c0b9abd7f
6
+ metadata.gz: 663bc1323338cc7261cb2281b5ad6a86d794baed1fd2dc82a08f8d1b5eae593a151927529330425d8ffdc71adb17e8a7c70aa3872c63641cd2d77dcfe46016cc
7
+ data.tar.gz: c894eff95679b5982e418dccff5deb160ff41a46e661bee2f8278b230ab59fe20befc8aed83b8144dd112485df98d61c6fa1f60d226f63a1df3db6cd34b4a9a4
@@ -34,8 +34,16 @@ module ActiveGraph::Node
34
34
 
35
35
  include Enumerable
36
36
 
37
- def each(&block)
38
- result_nodes.each(&block)
37
+ def each(node = true, rel = nil, &block)
38
+ return [] unless node || rel
39
+
40
+ if node && rel
41
+ result_nodes.zip(rels)
42
+ elsif node
43
+ result_nodes
44
+ else
45
+ rels
46
+ end.each(&block)
39
47
  end
40
48
 
41
49
  def each_rel(&block)
@@ -103,11 +111,11 @@ module ActiveGraph::Node
103
111
 
104
112
  def add_to_cache(object, rel = nil)
105
113
  (@cached_rels ||= []) << rel if rel
106
- (@cached_result ||= []).tap { |results| results << object unless results.include?(object) }
114
+ (@cached_result ||= []).tap { |results| results << object if object && !results.include?(object) }
107
115
  end
108
116
 
109
117
  def rels
110
- @cached_rels || super
118
+ @cached_rels || super.tap { |rels| rels.each { |rel| add_to_cache(nil, rel) } }
111
119
  end
112
120
 
113
121
  def cache_query_proxy_result
@@ -48,7 +48,7 @@ module ActiveGraph
48
48
  end
49
49
 
50
50
  def propagate_context(query_proxy)
51
- query_proxy.instance_variable_set(:@distinct, @distinct)
51
+ [:@distinct, :@rel_var].each { |var| query_proxy.instance_variable_set(var, instance_variable_get(var)) }
52
52
  end
53
53
 
54
54
  # @return [Integer] number of nodes of this class
@@ -1,3 +1,3 @@
1
1
  module ActiveGraph
2
- VERSION = '11.1.0.alpha.4'
2
+ VERSION = '11.1.0.beta.1'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activegraph
3
3
  version: !ruby/object:Gem::Version
4
- version: 11.1.0.alpha.4
4
+ version: 11.1.0.beta.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andreas Ronge, Brian Underwood, Chris Grigg, Heinrich Klobuczek
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-09-07 00:00:00.000000000 Z
11
+ date: 2022-11-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activemodel
@@ -444,7 +444,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
444
444
  - !ruby/object:Gem::Version
445
445
  version: 1.3.1
446
446
  requirements: []
447
- rubygems_version: 3.3.7
447
+ rubygems_version: 3.3.3
448
448
  signing_key:
449
449
  specification_version: 4
450
450
  summary: A graph database for Ruby