deep_cloneable_checked 1.0.1 → 1.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
  SHA256:
3
- metadata.gz: ae5f15517f7b64bd368d8300ea9837609f3d6b1f8f38dde1f3981d5cc421f69c
4
- data.tar.gz: ceb59ba3f33a98bd04a452dab32395ee56cd37796b061efb93322541ebc3210e
3
+ metadata.gz: 5edd682302405b1850f37d6a36658a9e9bb70c5fc5eeb39daedf87f3e7e4b4ae
4
+ data.tar.gz: ec9cb175130b846cef0aeb4b7efa2cdb7f38785d097316a846c822a41f88556d
5
5
  SHA512:
6
- metadata.gz: 1952904ebd2460c0f7277123f73db60a40451641a011989257af0f3e053a2e4a07a6459b87792c19e6c1c363082e3519d58f8a3fba92a2e89319e8b37198adf4
7
- data.tar.gz: 4e74c7ff8b65d57445ad752581878035845ab52e377585d688485aa5e103950c0d77a7e45ffbe2b0f8188842874691805b71a6b767eaf76b0d7047748a45d798
6
+ metadata.gz: d7a079c0fe7a450df2220bec1d5dcfb2b6b4ece5b9769a812a6396686b8c4a63e67719ecddcd61ec2868291bb0edf6576efbbe595dd6b7de306185885d4ac83f
7
+ data.tar.gz: e46add614f128646f9ea67f00270b883a9e20ede7747991be64004c6a8c4daae73026b4ede220b5a445913fd29a39ff079a1d6905a88a4362a588379a398bbd3
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- deep_cloneable_checked (1.0.0)
4
+ deep_cloneable_checked (1.1.0)
5
5
  deep_cloneable (~> 3.2.0)
6
6
 
7
7
  GEM
@@ -1,3 +1,5 @@
1
+ require 'set'
2
+
1
3
  module DeepCloneableChecked
2
4
  module DeepCloneChecked
3
5
  def deep_clone_checked(options)
@@ -11,13 +13,23 @@ module DeepCloneableChecked
11
13
  end
12
14
 
13
15
  def validate_clone_check(options)
16
+ checked = Set[]
17
+
14
18
  check_missing = lambda do |klass, includes, excludes|
15
19
  includes = DeepCloneableChecked.options_to_hash(includes)
16
20
  excludes = DeepCloneableChecked.options_to_hash(excludes)
17
21
  # puts "-----------\n klass: #{klass.name}, includes: #{includes.inspect}, excludes: #{excludes.inspect}"
22
+
23
+ # If we have already checked this class then we assume we don't
24
+ # clone it in a different manner. This assumption might not be valid
25
+ # but assuming otherwise would be complex and YAGNI (hopefully).
26
+ return nil if checked.include? klass
27
+
28
+ checked << klass
18
29
  associations = klass.reflections
19
-
30
+
20
31
  associations.map do |association_name, reflection|
32
+ next nil if reflection.is_a? ActiveRecord::Reflection::ThroughReflection
21
33
  next_excludes = excludes[association_name.to_sym]
22
34
  next_includes = includes[association_name.to_sym]
23
35
 
@@ -1,3 +1,3 @@
1
1
  module DeepCloneableChecked
2
- VERSION = "1.0.1"
2
+ VERSION = "1.2.0"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: deep_cloneable_checked
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kaori Kohama
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2022-09-07 00:00:00.000000000 Z
12
+ date: 2022-09-14 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: deep_cloneable