wallaby-core 0.3.0 → 0.3.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/wallaby/classifier.rb +8 -4
- data/lib/wallaby/configuration.rb +0 -1
- data/lib/wallaby/core/version.rb +1 -1
- data/lib/wallaby/map.rb +8 -0
- data/lib/wallaby/preloader.rb +0 -1
- metadata +8 -14
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 77a38a0ab63a07ad448529fb17dc50dbb49a1630f72306e4aaa59610746590ce
|
4
|
+
data.tar.gz: 03f07311987a06ef3fb7397cbf45a776e4ccc596701ff96249ca830e7a4ad4f7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 26bc2234b72c0420d8e3bbf5acc330cb10b57e592957817ff86dc7754fb791b97baa42717492dd447ce5ec25c8f249378761d9ef8895738f402817580b41db07
|
7
|
+
data.tar.gz: 679271f45ad30079876ed5b53e0acf1621e72367de6926f9cda5078b57a5d5223fe5e63186fe647372bb8ff67f2a7ede84276077dee41ccb3118551e16995f85
|
data/lib/wallaby/classifier.rb
CHANGED
@@ -23,14 +23,18 @@ module Wallaby
|
|
23
23
|
# blank string will lead to NameError `wrong constant name`
|
24
24
|
return if name.blank?
|
25
25
|
|
26
|
+
# [Performance] Caching the result for uninitialized constant
|
27
|
+
return (yield(name) if block_given?) if raising && Map.class_name_error_map[name] == :uninitialized
|
28
|
+
|
26
29
|
# NOTE: DO NOT try to use `const_defined?` and `const_get` EVER.
|
27
30
|
# Rails does all the class loading magics using `constantize`
|
28
31
|
name.constantize
|
29
32
|
rescue NameError => e
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
33
|
+
if raising
|
34
|
+
Map.class_name_error_map[name] ||=
|
35
|
+
e.message.start_with?('uninitialized constant') ? :uninitialized : :name_error
|
36
|
+
raise e if Map.class_name_error_map[name] == :name_error
|
37
|
+
end
|
34
38
|
|
35
39
|
# block to handle this missing constant, e.g. use a default class or log useful instruction
|
36
40
|
yield(name) if block_given?
|
@@ -104,7 +104,6 @@ module Wallaby
|
|
104
104
|
Deprecator.alert 'config.models.presence', from: '0.3.0', alternative: <<~INSTRUCTION
|
105
105
|
Please use controller_class.models instead.
|
106
106
|
INSTRUCTION
|
107
|
-
@models ||= Models.new
|
108
107
|
end
|
109
108
|
|
110
109
|
# To globally configure the models that Wallaby should handle.
|
data/lib/wallaby/core/version.rb
CHANGED
data/lib/wallaby/map.rb
CHANGED
@@ -102,6 +102,14 @@ module Wallaby
|
|
102
102
|
end
|
103
103
|
end
|
104
104
|
|
105
|
+
class << self
|
106
|
+
# @!attribute [r] class_name_error_map
|
107
|
+
# Cache the class name error
|
108
|
+
def class_name_error_map
|
109
|
+
@class_name_error_map ||= {}
|
110
|
+
end
|
111
|
+
end
|
112
|
+
|
105
113
|
class << self
|
106
114
|
# Reset all the instance variables to nil
|
107
115
|
def clear
|
data/lib/wallaby/preloader.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: wallaby-core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tianwen Chen
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-11-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activemodel
|
@@ -16,40 +16,34 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
20
|
-
- - "<"
|
21
|
-
- !ruby/object:Gem::Version
|
22
|
-
version: 8.0.0
|
19
|
+
version: '0'
|
23
20
|
type: :runtime
|
24
21
|
prerelease: false
|
25
22
|
version_requirements: !ruby/object:Gem::Requirement
|
26
23
|
requirements:
|
27
24
|
- - ">="
|
28
25
|
- !ruby/object:Gem::Version
|
29
|
-
version:
|
30
|
-
- - "<"
|
31
|
-
- !ruby/object:Gem::Version
|
32
|
-
version: 8.0.0
|
26
|
+
version: '0'
|
33
27
|
- !ruby/object:Gem::Dependency
|
34
28
|
name: railties
|
35
29
|
requirement: !ruby/object:Gem::Requirement
|
36
30
|
requirements:
|
37
31
|
- - ">="
|
38
32
|
- !ruby/object:Gem::Version
|
39
|
-
version:
|
33
|
+
version: 7.0.0
|
40
34
|
- - "<"
|
41
35
|
- !ruby/object:Gem::Version
|
42
|
-
version:
|
36
|
+
version: 9.0.0
|
43
37
|
type: :runtime
|
44
38
|
prerelease: false
|
45
39
|
version_requirements: !ruby/object:Gem::Requirement
|
46
40
|
requirements:
|
47
41
|
- - ">="
|
48
42
|
- !ruby/object:Gem::Version
|
49
|
-
version:
|
43
|
+
version: 7.0.0
|
50
44
|
- - "<"
|
51
45
|
- !ruby/object:Gem::Version
|
52
|
-
version:
|
46
|
+
version: 9.0.0
|
53
47
|
- !ruby/object:Gem::Dependency
|
54
48
|
name: parslet
|
55
49
|
requirement: !ruby/object:Gem::Requirement
|