neo4j 5.1.0.rc.2 → 5.1.0.rc.3

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: f2fc8fdc0533ca1dfbfa9253ecae0ed833267048
4
- data.tar.gz: 58295ba854140ebddaaf04974d848de2d25e7caa
3
+ metadata.gz: a5b693806fc0a4e354afd855697d172f97446895
4
+ data.tar.gz: 4816d6e5f1a882160788ccfa26d161250166a9b9
5
5
  SHA512:
6
- metadata.gz: 04b3b4a9e03d657b0d83c08a15a63c55cf7f2b8c97f2d08c12ad692d7fa653becca7768402caa2791e5899b999cd6c24be1409d383a49e0673557d330ed6d097
7
- data.tar.gz: a234fb10c17b6c5d7aafa092d09c0b80edea0a5332506ec466e8ae44960bd4aef93953733d4bf6bdb1dc2fdac37fc0d82419a3c78a3a07bcbb8f074ca9c787be
6
+ metadata.gz: 86232eb72791621cf0562dc36c56cbc052a0cf292d609bce5ebcf3a19d0cce02af8b76b44fe47ded24c85eed87e8be9d437cff90802738ba12e133a675023038
7
+ data.tar.gz: cec8b73a35e405d68df9cddf46732b41ff26b94d42d39412a8a50343aaa22204778769ef36d4186658338e2326ef90bc30fbe09ad1310589084c5b404e5f24c3
@@ -5,6 +5,21 @@ This project adheres to [Semantic Versioning](http://semver.org/).
5
5
 
6
6
  ## [Unreleased][unreleased]
7
7
 
8
+ ## [5.1.0.rc.3] - 08-17-2015
9
+
10
+ ### Fixed
11
+ - Associations defined in ActiveNode models will delegate `unique?` to the model set in `rel_class`. This makes it easier for the rel class to act as the single source of truth for relationship behavior.
12
+
13
+ ### Added
14
+ - ActiveRel: `#{related_node}_neo_id` instance methods to match CypherRelationship. Works with start/from and end/to.
15
+ - ActiveRel: `type` now has a new alias, `rel_type`. You might recognize this from the `(Cypher|Embedded)Relationship` class and ActiveNode association option.
16
+ - Contributing to the gem? Rejoice, for it now supports [Dotenv](https://github.com/bkeepers/dotenv).
17
+
18
+ ## [5.1.0.rc.2] - 08-16-2015
19
+
20
+ ### Added
21
+ - Ability to use `#where_not` method on `ActiveNode` / `QueryProxy`
22
+
8
23
  ## [5.1.0.rc.1] - 08-14-2015
9
24
 
10
25
  ### Fixed
data/Gemfile CHANGED
@@ -18,4 +18,5 @@ group 'test' do
18
18
  gem 'test-unit'
19
19
  gem 'overcommit'
20
20
  gem 'colored'
21
+ gem 'dotenv'
21
22
  end
@@ -135,6 +135,7 @@ module Neo4j
135
135
  end
136
136
 
137
137
  def unique?
138
+ return relationship_class.unique? if rel_class?
138
139
  @origin ? origin_association.unique? : !!@unique
139
140
  end
140
141
 
@@ -142,6 +143,11 @@ module Neo4j
142
143
  unique? ? :create_unique : :create
143
144
  end
144
145
 
146
+ def relationship_class?
147
+ !!relationship_class
148
+ end
149
+ alias_method :rel_class?, :relationship_class?
150
+
145
151
  private
146
152
 
147
153
  def association_model_namespace
@@ -138,7 +138,7 @@ module Neo4j
138
138
  @model.current_scope = previous
139
139
  end
140
140
 
141
- METHODS = %w(where rel_where order skip limit)
141
+ METHODS = %w(where where_not rel_where order skip limit)
142
142
 
143
143
  METHODS.each do |method|
144
144
  define_method(method) { |*args| build_deeper_query_proxy(method.to_sym, args) }
@@ -41,6 +41,12 @@ module Neo4j
41
41
  end
42
42
  alias_method :for_node_where_clause, :for_where_clause
43
43
 
44
+ def for_where_not_clause(*args)
45
+ for_where_clause(*args).each do |link|
46
+ link.instance_variable_set('@clause', :where_not)
47
+ end
48
+ end
49
+
44
50
  def new_for_key_and_value(model, key, value)
45
51
  key = (key.to_sym == :id ? model.id_property_name : key)
46
52
 
@@ -77,8 +83,8 @@ module Neo4j
77
83
  end
78
84
 
79
85
  def for_args(model, clause, args)
80
- if clause == :where && args[0].is_a?(String) # Better way?
81
- [for_arg(model, :where, args[0], *args[1..-1])]
86
+ if [:where, :where_not].include?(clause) && args[0].is_a?(String) # Better way?
87
+ [for_arg(model, clause, args[0], *args[1..-1])]
82
88
  else
83
89
  args.map { |arg| for_arg(model, clause, arg) }
84
90
  end
@@ -56,6 +56,10 @@ module Neo4j::ActiveRel
56
56
  obj.save!
57
57
  end
58
58
  end
59
+
60
+ def create_method
61
+ creates_unique? ? :create_unique : :create
62
+ end
59
63
  end
60
64
 
61
65
  private
@@ -96,7 +100,7 @@ module Neo4j::ActiveRel
96
100
  end
97
101
 
98
102
  def create_method
99
- self.class.creates_unique? ? :create_unique : :create
103
+ self.class.create_method
100
104
  end
101
105
  end
102
106
  end
@@ -14,10 +14,17 @@ module Neo4j::ActiveRel
14
14
  alias_method :start_node, :from_node
15
15
  alias_method :end_node, :to_node
16
16
 
17
+ %w(start_node end_node).each do |direction|
18
+ define_method("#{direction}_neo_id") { send(direction).neo_id if direction }
19
+ end
20
+ alias_method :from_node_neo_id, :start_node_neo_id
21
+ alias_method :to_node_neo_id, :end_node_neo_id
22
+
17
23
  # @return [String] a string representing the relationship type that will be created
18
24
  def type
19
- self.class._type
25
+ self.class.type
20
26
  end
27
+ alias_method :rel_type, :type
21
28
 
22
29
  def initialize(attributes = nil)
23
30
  super(attributes)
@@ -74,6 +81,7 @@ WARNING
74
81
  def creates_unique?
75
82
  !!@creates_unique
76
83
  end
84
+ alias_method :unique?, :creates_unique?
77
85
  end
78
86
 
79
87
  private
@@ -31,15 +31,22 @@ module Neo4j
31
31
  subclass.type subclass.namespaced_model_name, true
32
32
  end
33
33
 
34
+ # When called without arguments, it will return the current setting or supply a default.
35
+ # When called with arguments, it will change the current setting.
34
36
  # @param [String] given_type sets the relationship type when creating relationships via this class
35
37
  # @param [Boolean] auto Should the given_type be changed in compliance with the gem's rel decorator setting?
36
- # This option is used internally, users will usually ignore it.
37
38
  def type(given_type = nil, auto = false)
38
- return rel_type if given_type.nil?
39
- @rel_type = (auto ? decorated_rel_type(given_type) : given_type).tap do |type|
40
- add_wrapped_class(type) unless uses_classname?
39
+ case
40
+ when !given_type && rel_type?
41
+ @rel_type
42
+ when given_type
43
+ assign_type!(given_type, auto)
44
+ else
45
+ assign_type!(namespaced_model_name, true)
41
46
  end
42
47
  end
48
+ alias_method :rel_type, :type
49
+ alias_method :_type, :type # should be deprecated
43
50
 
44
51
  def namespaced_model_name
45
52
  case Neo4j::Config[:module_handling]
@@ -52,13 +59,6 @@ module Neo4j
52
59
  end
53
60
  end
54
61
 
55
- def rel_type
56
- @rel_type || type(namespaced_model_name, true)
57
- end
58
-
59
- # @return [String] a string representing the relationship type that will be created
60
- alias_method :_type, :rel_type # Should be deprecated
61
-
62
62
  def add_wrapped_class(type)
63
63
  # _wrapped_classes[type.to_sym.downcase] = self.name
64
64
  _wrapped_classes[type.to_sym] = self.name
@@ -67,6 +67,18 @@ module Neo4j
67
67
  def _wrapped_classes
68
68
  Neo4j::ActiveRel::Types::WRAPPED_CLASSES
69
69
  end
70
+
71
+ def rel_type?
72
+ !!@rel_type
73
+ end
74
+
75
+ private
76
+
77
+ def assign_type!(given_type, auto)
78
+ @rel_type = (auto ? decorated_rel_type(given_type) : given_type).tap do |type|
79
+ add_wrapped_class(type) unless uses_classname?
80
+ end
81
+ end
70
82
  end
71
83
  end
72
84
  end
@@ -1,3 +1,3 @@
1
1
  module Neo4j
2
- VERSION = '5.1.0.rc.2'
2
+ VERSION = '5.1.0.rc.3'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: neo4j
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.1.0.rc.2
4
+ version: 5.1.0.rc.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andreas Ronge, Brian Underwood, Chris Grigg
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-08-16 00:00:00.000000000 Z
11
+ date: 2015-08-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: orm_adapter
@@ -322,7 +322,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
322
322
  version: 1.3.1
323
323
  requirements: []
324
324
  rubyforge_project: neo4j
325
- rubygems_version: 2.4.5
325
+ rubygems_version: 2.4.6
326
326
  signing_key:
327
327
  specification_version: 4
328
328
  summary: A graph database for Ruby