orthoses-rails 1.1.0 → 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: ec337b1da4ecda39f953797824239ede59c536c74da48cc1dbd01e46eed1d2b0
4
- data.tar.gz: b146481d3fda9b3568a1593fd05608f09c811e1181356f2e36d2b010c30dd130
3
+ metadata.gz: d9681e80e9a106b8d984c304a0f26777deb5e2077aba6f8a0321f52976e24bcc
4
+ data.tar.gz: c1f248d0e236bc72491e507da185317d55d607cebf4d6364209cd1601cacb6aa
5
5
  SHA512:
6
- metadata.gz: 2bec23dc332048a010d10a2dc01754b969f76d2dd19bfa4b50393c1a764b3de496a35d018560aca04fe43630de497e900bb580774698bda3073ea33dcbf44bb5
7
- data.tar.gz: e2dac22ee12a3bf049a73e5609d4a3ca1693c2dbc851c3bb06256e4566e9adad6c991fa9a60b0aaa7b22d6ea19e0c7cbc65c403cd136669d4c98b58deb7d90e7
6
+ metadata.gz: 8ff02244b5844c28186021d4379818a5a0b56ffcb693425f500e3145ff36da721a278c972a6a324e3b3b26bcb3ce9652c98f9fb3c15549fd51924371362d37fb
7
+ data.tar.gz: 284d60f37efb290cf6e5230dd10cda55066278e89e4b81866896793c535b4864edc7cb13c389d0c98a861c34630fba09df3bb04b1035291f7c4cc46666d22b9b
@@ -18,15 +18,7 @@ module Orthoses
18
18
  type = if ref.polymorphic?
19
19
  'untyped'
20
20
  else
21
- begin
22
- Utils.module_name(ref.klass) or next
23
- rescue NameError => e
24
- while e
25
- Orthoses.logger.warn(e.message)
26
- e = e.cause
27
- end
28
- next
29
- end
21
+ Orthoses::ActiveRecord.reflection_klass_name(ref) or next
30
22
  end
31
23
  opt = "#{type}?"
32
24
 
@@ -15,16 +15,7 @@ module Orthoses
15
15
 
16
16
  lines = base.reflect_on_all_associations(:has_many).flat_map do |ref|
17
17
  singular_name = ref.name.to_s.singularize
18
- type =
19
- begin
20
- Utils.module_name(ref.klass)
21
- rescue NameError => e
22
- while e
23
- Orthoses.logger.warn(e.message)
24
- e = e.cause
25
- end
26
- next
27
- end
18
+ type = Orthoses::ActiveRecord.reflection_klass_name(ref) or next
28
19
 
29
20
  collection_proxy = "::#{type}::ActiveRecord_Associations_CollectionProxy"
30
21
  [
@@ -14,16 +14,7 @@ module Orthoses
14
14
  base_name = Utils.module_name(base) || next
15
15
 
16
16
  lines = base.reflect_on_all_associations(:has_one).flat_map do |ref|
17
- type =
18
- begin
19
- Utils.module_name(ref.klass) or next
20
- rescue NameError => e
21
- while e
22
- Orthoses.logger.warn(e.message)
23
- e = e.cause
24
- end
25
- next
26
- end
17
+ type = Orthoses::ActiveRecord.reflection_klass_name(ref) or next
27
18
  opt = "#{type}?"
28
19
 
29
20
  [
@@ -43,5 +43,16 @@ module Orthoses
43
43
  'untyped'
44
44
  end
45
45
  end
46
+
47
+ def self.reflection_klass_name(ref)
48
+ Utils.module_name(ref.klass)
49
+ rescue NameError, ArgumentError => e
50
+ while e
51
+ Orthoses.logger.warn(e.message)
52
+ e = e.cause
53
+ end
54
+
55
+ nil
56
+ end
46
57
  end
47
58
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Orthoses
4
4
  module Rails
5
- VERSION = "1.1.0"
5
+ VERSION = "1.2.0"
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: orthoses-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - ksss
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-08-30 00:00:00.000000000 Z
11
+ date: 2023-09-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: orthoses
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '1.10'
19
+ version: '1.11'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: '1.10'
26
+ version: '1.11'
27
27
  description: Orthoses middleware collection for Ruby on Rails
28
28
  email:
29
29
  - co000ri@gmail.com