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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 62237e7dafd589f3a2abe8180ada5c30b7bc12dffa5e165c428dfb4c4a25af7b
4
- data.tar.gz: 002ef52d6ad7e0f6735db23c37b033dc24df6af2e0ddd116d593ed88f21f00a1
3
+ metadata.gz: 314c68d13c5f37c277a4a53b84f58dd054ae5d2be176e8e575dc92a44099124f
4
+ data.tar.gz: 36e153d37023168ac51a7f6f1b26854c3588fa7394f796f04720fedf619d601e
5
5
  SHA512:
6
- metadata.gz: 4657e85cf211773ba1749e475b1110476fab90a312bb5233f78ca459653ef477090d7c38753390948afb539e21bd831a9960c1395dbbee5f15d0fcb3b40f3f91
7
- data.tar.gz: 8023fed0a8ae2ab3b84aa6c76ba0aecbe3ed9d93bbf2d70b094c91afdb1e9a459927dd5f473a046fd7b3ccb45a85b833bb775b9ed4c9374fd9cee06ba182735e
6
+ metadata.gz: 7487ba2280bab3230701541f00da5133af8ab6760454a58fdf06c2ff20340a14734577b026a1dffe232c75248b3cd821ebea42a9fbd4c581a3ef5e296c1a2d1f
7
+ data.tar.gz: 4f03ea6939f779b78c3cb0141d50553894d4b2baf98f408ecc3f3cb91098b7df64abe577fe8586283cb499de6c4fa674a8f4c756388f5df64c08887c0b9abd7f
data/activegraph.gemspec CHANGED
@@ -33,7 +33,7 @@ DESCRIPTION
33
33
  s.add_dependency('activemodel', '>= 4.0')
34
34
  s.add_dependency('activesupport', '>= 4.0')
35
35
  s.add_dependency('i18n', '!= 1.8.8') # https://github.com/jruby/jruby/issues/6547
36
- s.add_dependency('neo4j-ruby-driver', '>= 4.4.0.alpha.5')
36
+ s.add_dependency('neo4j-ruby-driver', '>= 4.4.0.alpha.7')
37
37
  s.add_dependency('orm_adapter', '~> 0.5.0')
38
38
  s.add_dependency('sorted_set')
39
39
  s.add_development_dependency('guard')
@@ -5,7 +5,6 @@ module ActiveGraph
5
5
  extend ActiveSupport::Concern
6
6
  include ActiveGraph::Shared::Validations
7
7
 
8
-
9
8
  # @return [Boolean] true if valid
10
9
  def valid?(context = nil)
11
10
  context ||= (new_record? ? :create : :update)
@@ -19,7 +18,6 @@ module ActiveGraph
19
18
  end
20
19
  end
21
20
 
22
-
23
21
  class UniquenessValidator < ::ActiveModel::EachValidator
24
22
  def initialize(options)
25
23
  super(options.reverse_merge(case_sensitive: true))
@@ -32,14 +30,19 @@ module ActiveGraph
32
30
  end
33
31
 
34
32
  def found(record, attribute, value)
35
- conditions = scope_conditions(record)
33
+ scopes, attributes = Array(options[:scope] || []).partition { |s| s.is_a?(Proc) }
34
+ conditions = scope_conditions(record, attributes)
36
35
 
37
36
  # TODO: Added as find(:name => nil) throws error
38
37
  value = '' if value.nil?
39
38
 
40
39
  conditions[attribute] = options[:case_sensitive] ? value : /#{Regexp.escape(value.to_s)}/i
41
40
 
42
- found = record.class.as(:result).where(conditions)
41
+ found = if scopes.empty?
42
+ record.class.as(:result)
43
+ else
44
+ scopes.reduce(record) { |proxy, scope| proxy.instance_eval(&scope) }
45
+ end.where(conditions)
43
46
  found = found.where_not(neo_id: record.neo_id) if record._persisted_obj
44
47
  found
45
48
  end
@@ -48,8 +51,8 @@ module ActiveGraph
48
51
  super || 'has already been taken'
49
52
  end
50
53
 
51
- def scope_conditions(instance)
52
- Array(options[:scope] || []).inject({}) do |conditions, key|
54
+ def scope_conditions(instance, attributes)
55
+ attributes.inject({}) do |conditions, key|
53
56
  conditions.merge(key => instance[key])
54
57
  end
55
58
  end
@@ -72,7 +72,7 @@ module ActiveGraph
72
72
  register_neo4j_cypher_logging
73
73
 
74
74
  method = url.is_a?(Enumerable) ? :routing_driver : :driver
75
- Neo4j::Driver::GraphDatabase.send(method, url, auth_token, config)
75
+ Neo4j::Driver::GraphDatabase.send(method, url, auth_token, **config)
76
76
  end
77
77
 
78
78
  def final_driver_config!(config)
@@ -89,8 +89,8 @@ COMMENT
89
89
 
90
90
  ActiveGraph::Migrations::Schema.synchronize_schema_data(schema_data, args[:remove_missing])
91
91
 
92
+ runner = ActiveGraph::Base.transaction { ActiveGraph::Migrations::Runner.new }
92
93
  ActiveGraph::Base.transaction do
93
- runner = ActiveGraph::Migrations::Runner.new
94
94
  runner.mark_versions_as_complete(schema_data[:versions]) # Run in test mode?
95
95
  end
96
96
  end
@@ -1,3 +1,3 @@
1
1
  module ActiveGraph
2
- VERSION = '11.1.0.alpha.1'
2
+ VERSION = '11.1.0.alpha.4'
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.1
4
+ version: 11.1.0.alpha.4
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-06-24 00:00:00.000000000 Z
11
+ date: 2022-09-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activemodel
@@ -58,14 +58,14 @@ dependencies:
58
58
  requirements:
59
59
  - - ">="
60
60
  - !ruby/object:Gem::Version
61
- version: 4.4.0.alpha.5
61
+ version: 4.4.0.alpha.7
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - ">="
67
67
  - !ruby/object:Gem::Version
68
- version: 4.4.0.alpha.5
68
+ version: 4.4.0.alpha.7
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: orm_adapter
71
71
  requirement: !ruby/object:Gem::Requirement