ree 1.2.1 → 1.2.2
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/Gemfile.lock +1 -1
- data/lib/ree/object_compiler.rb +26 -6
- data/lib/ree/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: 9856a98c27c0d4c9a5bc2c62ba473f9d6c19b1b366d1222afe705d78abbf3a4b
|
|
4
|
+
data.tar.gz: 27d745f77eeedf4dc490bf2006e8b51670df51b07d61849d0111261c176467de
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 41161ca3747a4d15af34aebe171254a1a16e273c7d017b2c988264e14a92c5d36f4cb5ca85f131a5c9a19067ca83d2a698c7ca4d6c8095cf907a28a180ed460f
|
|
7
|
+
data.tar.gz: c3a47bb26c4a9d40b7d4ff52a145bd64c9f9e4d6b310b3b83bc1c2977701638ec399c8dddb052649dd7bbbaccc6760624d6955073ab32d820f31ea9e7721afcc
|
data/Gemfile.lock
CHANGED
data/lib/ree/object_compiler.rb
CHANGED
|
@@ -160,15 +160,35 @@ class Ree::ObjectCompiler
|
|
|
160
160
|
#{str}
|
|
161
161
|
ruby_eval
|
|
162
162
|
|
|
163
|
-
if Ree.benchmark_mode? && object.fn? && !klass.
|
|
164
|
-
klass.instance_variable_set(:@__ree_benchmark_prepended, true)
|
|
163
|
+
if Ree.benchmark_mode? && object.fn? && !klass.method_defined?(:__call_without_benchmark)
|
|
165
164
|
benchmark_name = "#{object.package_name}/#{object.name}"
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
165
|
+
|
|
166
|
+
wrap_call_with_benchmark = proc do |target_klass|
|
|
167
|
+
target_klass.alias_method(:__call_without_benchmark, :call)
|
|
168
|
+
|
|
169
|
+
target_klass.define_method(:call) do |*args, **kwargs, &block|
|
|
170
|
+
Ree::BenchmarkTracer.trace(benchmark_name) do
|
|
171
|
+
__call_without_benchmark(*args, **kwargs, &block)
|
|
172
|
+
end
|
|
173
|
+
end
|
|
174
|
+
end
|
|
175
|
+
|
|
176
|
+
if klass.method_defined?(:call)
|
|
177
|
+
wrap_call_with_benchmark.call(klass)
|
|
178
|
+
else
|
|
179
|
+
klass.instance_variable_set(:@__ree_benchmark_wrap, wrap_call_with_benchmark)
|
|
180
|
+
|
|
181
|
+
klass.define_singleton_method(:method_added) do |method_name|
|
|
182
|
+
if method_name == :call && !method_defined?(:__call_without_benchmark)
|
|
183
|
+
wrap = instance_variable_get(:@__ree_benchmark_wrap)
|
|
184
|
+
if wrap
|
|
185
|
+
remove_instance_variable(:@__ree_benchmark_wrap)
|
|
186
|
+
wrap.call(self)
|
|
187
|
+
end
|
|
188
|
+
end
|
|
189
|
+
super(method_name)
|
|
169
190
|
end
|
|
170
191
|
end
|
|
171
|
-
klass.prepend(benchmark_mod)
|
|
172
192
|
end
|
|
173
193
|
|
|
174
194
|
# compile all linked objects
|
data/lib/ree/version.rb
CHANGED