low_type 1.1.3 → 1.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/factories/proxy_factory.rb +4 -2
- data/lib/low_type.rb +3 -1
- data/lib/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 2ed9039d493d3be677095a358691d03a7edf2dfd6416b48dfa352d03fec7cef7
|
|
4
|
+
data.tar.gz: 832ac8f63eec8a4e03d616286bea41f9945e0c30fbe55afe41f88857a82e01e9
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: b3eb8482d26eed780072944c51a00afb5e0d6cb360d754f37208453728102a07ed227ed13d17735e096ff107709b06e61d215ee6b0d89b3b9cdf5099048a643e
|
|
7
|
+
data.tar.gz: 3710dfca9e28556e2d8a781585adc809992b6469e0f3cd4f7c26fcd82e54d149a303f020522531b1350adaf954e09ffc8f02813c88c83f5718f5b334c59d4939
|
|
@@ -25,13 +25,15 @@ module LowType
|
|
|
25
25
|
def param_proxies(method_node:, file:)
|
|
26
26
|
return [] if method_node.parameters.nil?
|
|
27
27
|
|
|
28
|
+
params_without_block = method_node.parameters.slice.delete_suffix(', &block')
|
|
29
|
+
|
|
28
30
|
# Not a security risk because the code comes from a trusted source; the file that did the include. Does the file trust itself?
|
|
29
|
-
ruby_method = eval("-> (#{
|
|
31
|
+
ruby_method = eval("-> (#{params_without_block}) {}", binding, __FILE__, __LINE__) # rubocop:disable Security/Eval
|
|
30
32
|
|
|
31
33
|
# Not a security risk because the code comes from a trusted source; the file that did the include. Does the file trust itself?
|
|
32
34
|
# Local variable names are prefixed with __lt or __rb where necessary to avoid being overridden by method parameters.
|
|
33
35
|
typed_method = <<~RUBY
|
|
34
|
-
-> (#{
|
|
36
|
+
-> (#{params_without_block}, __rb_method:, __lt_file:) {
|
|
35
37
|
param_proxies_for_type_expressions(ruby_method: __rb_method, file: __lt_file, method_binding: binding)
|
|
36
38
|
}
|
|
37
39
|
RUBY
|
data/lib/low_type.rb
CHANGED
|
@@ -11,7 +11,7 @@ require_relative 'types/complex_types'
|
|
|
11
11
|
|
|
12
12
|
module LowType
|
|
13
13
|
# We do as much as possible on class load rather than on instantiation to be thread-safe and efficient.
|
|
14
|
-
def self.included(klass)
|
|
14
|
+
def self.included(klass) # rubocop:disable Metrics/AbcSize
|
|
15
15
|
require_relative 'syntax/union_types' if LowType.config.union_type_expressions
|
|
16
16
|
|
|
17
17
|
class << klass
|
|
@@ -21,6 +21,8 @@ module LowType
|
|
|
21
21
|
end
|
|
22
22
|
|
|
23
23
|
file_path = FileQuery.file_path(klass:)
|
|
24
|
+
return unless File.exist?(file_path)
|
|
25
|
+
|
|
24
26
|
parser = FileParser.new(klass:, file_path:)
|
|
25
27
|
|
|
26
28
|
klass.extend TypeAccessors
|
data/lib/version.rb
CHANGED