neo4j 9.1.8 → 9.2.0

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: 842191c44b13a4617ba19ce62e6b5d3179678c1e
4
- data.tar.gz: 43f5f578a72409ee07c739331212c72b0a4996be
3
+ metadata.gz: 67c0f2fd54679230595111f53cebdbf903a1438e
4
+ data.tar.gz: fe2f94f8ab2da07e40060260c7cf7c527b978649
5
5
  SHA512:
6
- metadata.gz: c0f44c117c92a7ab2851d58ac0a515a3f72e63826fae0939088681832cce66022da8f3b6ea93319d413d3f80015e0ae2224435ab7f817ee1265e2ecf7557f586
7
- data.tar.gz: 75ce59a03daf27109d80013780109b05c8573552631cc7ae26cb9f748e3ffe0d8ba1c2ae1d3d67d0450e04b216d0f04d78c4508a3439c53c4575af9467240e98
6
+ metadata.gz: a6514e9e4161b5c6816afafa79b7d99a2104ff192fca8ee8d2bc344012fec68c8a531dcf745c1f8f6c80bcb9f98cc0204d66282db430a14b79d2e3b46b8ac42d
7
+ data.tar.gz: 51f664641fb807f2fe7406cd939dc90b0b0d92dd8e99434fbec4a347c85fd755f3314063dd271ef8c91422656aa0f19613af82e897bb5a223b075ad4563b0b09
data/CHANGELOG.md CHANGED
@@ -3,6 +3,18 @@ All notable changes to this project will be documented in this file.
3
3
  This file should follow the standards specified on [http://keepachangelog.com/]
4
4
  This project adheres to [Semantic Versioning](http://semver.org/).
5
5
 
6
+ ## [9.2.0] 2018-03-27
7
+
8
+ ## Added
9
+
10
+ - Ability to create association with `labels: false` by default (thanks @thefliik / see #1485)
11
+
12
+ ## [9.1.8] 2018-03-27
13
+
14
+ ## Fixed
15
+
16
+ - Micro-optimizations which help when dealing with a lot of data (thanks @jgaskins / see #1490)
17
+
6
18
  ## [9.1.8] 2018-03-27
7
19
 
8
20
  ## Fixed
@@ -364,7 +364,7 @@ module Neo4j::ActiveNode
364
364
  name = name.to_sym
365
365
  build_association(:has_many, direction, name, options)
366
366
 
367
- define_has_many_methods(name)
367
+ define_has_many_methods(name, options)
368
368
  end
369
369
 
370
370
  # For defining an "has one" association on a model. This defines a set of methods on
@@ -381,17 +381,21 @@ module Neo4j::ActiveNode
381
381
  name = name.to_sym
382
382
  build_association(:has_one, direction, name, options)
383
383
 
384
- define_has_one_methods(name)
384
+ define_has_one_methods(name, options)
385
385
  end
386
386
 
387
387
  private
388
388
 
389
- def define_has_many_methods(name)
389
+ def define_has_many_methods(name, association_options)
390
+ default_options = association_options.slice(:labels)
391
+
390
392
  define_method(name) do |node = nil, rel = nil, options = {}|
391
393
  # return [].freeze unless self._persisted_obj
392
394
 
393
395
  options, node = node, nil if node.is_a?(Hash)
394
396
 
397
+ options = default_options.merge(options)
398
+
395
399
  association_proxy(name, {node: node, rel: rel, source_object: self, labels: options[:labels]}.merge!(options))
396
400
  end
397
401
 
@@ -402,6 +406,8 @@ module Neo4j::ActiveNode
402
406
  define_class_method(name) do |node = nil, rel = nil, options = {}|
403
407
  options, node = node, nil if node.is_a?(Hash)
404
408
 
409
+ options = default_options.merge(options)
410
+
405
411
  association_proxy(name, {node: node, rel: rel, labels: options[:labels]}.merge!(options))
406
412
  end
407
413
  end
@@ -435,8 +441,10 @@ module Neo4j::ActiveNode
435
441
  define_method(method_name, block) unless method_defined?(method_name)
436
442
  end
437
443
 
438
- def define_has_one_methods(name)
439
- define_has_one_getter(name)
444
+ def define_has_one_methods(name, association_options)
445
+ default_options = association_options.slice(:labels)
446
+
447
+ define_has_one_getter(name, default_options)
440
448
 
441
449
  define_has_one_setter(name)
442
450
 
@@ -445,6 +453,8 @@ module Neo4j::ActiveNode
445
453
  define_class_method(name) do |node = nil, rel = nil, options = {}|
446
454
  options, node = node, nil if node.is_a?(Hash)
447
455
 
456
+ options = default_options.merge(options)
457
+
448
458
  association_proxy(name, {node: node, rel: rel, labels: options[:labels]}.merge!(options))
449
459
  end
450
460
  end
@@ -463,10 +473,12 @@ module Neo4j::ActiveNode
463
473
  end
464
474
  end
465
475
 
466
- def define_has_one_getter(name)
476
+ def define_has_one_getter(name, default_options)
467
477
  define_method(name) do |node = nil, rel = nil, options = {}|
468
478
  options, node = node, nil if node.is_a?(Hash)
469
479
 
480
+ options = default_options.merge(options)
481
+
470
482
  association_proxy = association_proxy(name, {node: node, rel: rel}.merge!(options))
471
483
 
472
484
  # Return all results if options[:chainable] == true or a variable-length relationship length was given
@@ -203,7 +203,9 @@ module Neo4j
203
203
  check_valid_type_and_dir(type, direction)
204
204
  end
205
205
 
206
- VALID_ASSOCIATION_OPTION_KEYS = [:type, :origin, :model_class, :rel_class, :dependent, :before, :after, :unique]
206
+ # the ":labels" option is not used by the association per-say.
207
+ # Instead, if provided,it is used by the association getter as a default getter options argument
208
+ VALID_ASSOCIATION_OPTION_KEYS = [:type, :origin, :model_class, :rel_class, :dependent, :before, :after, :unique, :labels]
207
209
 
208
210
  def validate_association_options!(_association_name, options)
209
211
  ClassArguments.validate_argument!(options[:model_class], 'model_class')
data/lib/neo4j/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Neo4j
2
- VERSION = '9.1.8'
2
+ VERSION = '9.2.0'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: neo4j
3
3
  version: !ruby/object:Gem::Version
4
- version: 9.1.8
4
+ version: 9.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andreas Ronge, Brian Underwood, Chris Grigg