lowtype 1.7.2 → 1.7.3
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/definitions/redefiner.rb +6 -2
- 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: 551907b8ea44ce8bf3b0a7483429d1b00808a8d0426bec81f38ad9a22db5c17d
|
|
4
|
+
data.tar.gz: ac2261758eb31ad688162d77b6883ad8730f24d93671cbf98ec3a8c51c3a664a
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: ffd707a79f5fa9b72ad9378e16fc21fd5b2d238334fee2f024bc94584bd964d1c1c3908fca691b932663ac381b395e2fc234baea5def414d178adf3320b17c92
|
|
7
|
+
data.tar.gz: 616fef72cfd37c55ad5c50e1bdddc590509417553419ddcc2d94ea93be183b7b68291a0154fe730e2f125699cf0e72b7e7e82b736ddf8c2bbbf0dd1f84a07f86
|
|
@@ -120,12 +120,16 @@ module Low
|
|
|
120
120
|
# A method evaluated with "class_eval" finds constants in its class but not in the modules the class is nested in,
|
|
121
121
|
# like "TrieNode" from "Rain::TrieNode", which Ruby finds for the method as written. So the method is evaluated
|
|
122
122
|
# inside each module and class of the target's name. The method still reports its own file and line.
|
|
123
|
+
# A method in "class << self" is evaluated inside "class << self" in its class, so it finds its class's constants
|
|
124
|
+
# too, like "BODY_METHODS" in "Low::RequestParser", rather than only the singleton class's.
|
|
123
125
|
def evaluate_nested(target:, source:, file_path:, line:)
|
|
124
|
-
|
|
126
|
+
singleton = target.singleton_class? && target.attached_object.is_a?(Module)
|
|
127
|
+
namespaces = nesting(target: singleton ? target.attached_object : target)
|
|
125
128
|
return target.class_eval(source, file_path, line) unless namespaces
|
|
126
129
|
|
|
127
130
|
opening = namespaces.map { |namespace| "#{namespace.is_a?(Class) ? 'class' : 'module'} #{namespace.name.split('::').last};" }
|
|
128
|
-
|
|
131
|
+
opening << 'class << self;' if singleton
|
|
132
|
+
closing = ' end;' * opening.size
|
|
129
133
|
TOPLEVEL_BINDING.eval("#{opening.join(' ')} #{source}\n#{closing}", file_path, line)
|
|
130
134
|
end
|
|
131
135
|
|
data/lib/version.rb
CHANGED