n1_loader 1.6.6 → 1.7.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
  SHA256:
3
- metadata.gz: f7d5587fbac0376006abf03b7beb385547b1c9206cdeea8461d9bf07b67e0df4
4
- data.tar.gz: 6f94574d65b49c528a6af3e06d6d816ed78ef3cf3f6e14002249b816526cbb4a
3
+ metadata.gz: e9be9c5e7d5e551d253a327cd3d130a38821ef49a43cab60235cc5363a4093d0
4
+ data.tar.gz: 55c8e748bf52fc05b8648d81d907963b4a60eae0b7aa680d0c491987b43303d3
5
5
  SHA512:
6
- metadata.gz: 39d0370fee07be7e080adb22392633366da8cce0b74228c728b8647e9f7f859b4c995346bf0a8e9b477c355374b29f4f4690f089c6b6904822af3cfba88685af
7
- data.tar.gz: 0245c5ba26df1d3f3508a22143ae5cb9d708c5460ef218ee2193b8cc537bf0ee6f6838357be50fe4d2d2d4c1db050e76a6176e98b3b7df4c64af4bf7b0e35e36
6
+ metadata.gz: b626c836856198a9e0d0f54daedd0299b2cd7eb0648ddde369a6b7f923751b31d402c8ba03ab67bb064b884e5c5f035babcd1f59d0bef93db26968f7e6fca7ae
7
+ data.tar.gz: 640e8decd4c53e4f09451041392b964b5f0e59a273719673978e4bf62d26543364b5b4166d97833b7a5084ebacfe7921a921a5c0aae3938c3ce9394f6627bfc8
data/CHANGELOG.md CHANGED
@@ -1,3 +1,44 @@
1
+ ## [1.6.7] - 2023/07/30
2
+
3
+ Extend the flexibility of loading data comparison. Thanks [Nazar Matus](https://github.com/FunkyloverOne) for suggesting it!
4
+
5
+ **BREAKING CHANGES:**
6
+
7
+ Loose comparison of loaded data. Before loaded data was initialized with identity comparator in mind:
8
+
9
+ ```ruby
10
+ @loaded = {}.compare_by_identity
11
+ ```
12
+
13
+ Now it will be:
14
+
15
+ ```ruby
16
+ @loaded = {}
17
+ ```
18
+
19
+ This might bring unwanted results for cases when strict comparison was wanted.
20
+
21
+ On the other hand, it gives more flexibility for many other cases, especially with isolated loader.
22
+ For example, this will work now, when it wasn't working before.
23
+
24
+ ```ruby
25
+ # ActiveRecord object
26
+ object = Entity.first
27
+
28
+ # Initialize isolated loader
29
+ instance = loader.new([object])
30
+
31
+ # This was working before because the loaded object is identical to passed object by `#object_id`
32
+ instance.for(object)
33
+
34
+ # This wasn't working before because the loaded object is not identical to passed one by `#object_id`
35
+ #
36
+ # But it will be working now, because object == Entity.find(object.id)
37
+ instance.for(Entity.find(object.id))
38
+ ```
39
+
40
+ If you need strict comparison support, please feel free to open the issue or the PR.
41
+
1
42
  ## [1.6.6] - 2023/07/30
2
43
 
3
44
  - Fix naive check of required arguments. Thanks [Nazar Matus](https://github.com/FunkyloverOne) for the issue!
@@ -106,7 +106,7 @@ module N1Loader
106
106
 
107
107
  check_arguments!
108
108
 
109
- @loaded = {}.compare_by_identity
109
+ @loaded = {}
110
110
 
111
111
  if respond_to?(:single) && elements.size == 1
112
112
  fulfill(elements.first, single(elements.first))
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module N1Loader
4
- VERSION = "1.6.6"
4
+ VERSION = "1.7.0"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: n1_loader
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.6.6
4
+ version: 1.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Evgeniy Demin