require_bench 1.0.4.pre.alpha.6 → 1.0.4.pre.alpha.7
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/require_bench/version.rb +1 -1
- data/lib/require_bench.rb +14 -14
- 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: 919c2f3cdaf47fedf1ca5771b0cc7b9cad4e42f33d86a53c1a6e90b858103414
|
4
|
+
data.tar.gz: 976f0fcb04c3099bd3e3bb4edce225f488b12f12833b5f838b0ba694f46a8924
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d3e46233df51c7263489a8851f4da8f96a64bb83e863819a119baf4674fe3f9f95f6b832e5edb3a8f3c8441a29b1c07bf8c4cdb841c94d0760b947c09ca8c17b
|
7
|
+
data.tar.gz: 84fae936ba01e83d7e6e6d4be55cfd77e0461812a0eb82924702c3082f86c3f4d173762d88891447867ecfb2666254d1e16d9e8c51df48e8a08c5fe88d06e816
|
data/lib/require_bench.rb
CHANGED
@@ -90,7 +90,7 @@ module RequireBench
|
|
90
90
|
TIMEOUT = timeout
|
91
91
|
TRACKED_METHODS = tracked_methods
|
92
92
|
|
93
|
-
def consume_with_timing(type, file)
|
93
|
+
def consume_with_timing(type, file, *args)
|
94
94
|
$require_bench_semaphore = true
|
95
95
|
short_type = type[0]
|
96
96
|
ret = nil
|
@@ -99,12 +99,12 @@ module RequireBench
|
|
99
99
|
|
100
100
|
seconds = Benchmark.realtime do
|
101
101
|
ret = if RequireBench::TIMEOUT.zero?
|
102
|
-
Kernel.send("#{type}_without_timing", file)
|
102
|
+
Kernel.send("#{type}_without_timing", file, *args)
|
103
103
|
else
|
104
104
|
# Raise Timeout::Error if more than RequireBench::TIMEOUT seconds are spent in the block
|
105
105
|
# This is a giant hammer, and should probably only be used to figure out where an infinite loop might be hiding.
|
106
106
|
Timeout.timeout(RequireBench::TIMEOUT) do
|
107
|
-
Kernel.send("#{type}_without_timing", file)
|
107
|
+
Kernel.send("#{type}_without_timing", file, *args)
|
108
108
|
end
|
109
109
|
end
|
110
110
|
end
|
@@ -142,17 +142,17 @@ if REQUIRE_BENCH_ENABLED
|
|
142
142
|
_require_bench_consume_file('require', file)
|
143
143
|
end
|
144
144
|
|
145
|
-
def load(file)
|
146
|
-
_require_bench_consume_file('load', file)
|
145
|
+
def load(file, *args)
|
146
|
+
_require_bench_consume_file('load', file, *args)
|
147
147
|
end
|
148
148
|
|
149
|
-
def _require_bench_consume_file(type, file)
|
149
|
+
def _require_bench_consume_file(type, file, *args)
|
150
150
|
file_path = file.to_s
|
151
151
|
# byebug if file_path.match?(/no_group_fox/)
|
152
152
|
|
153
153
|
# Global $ variable, which is always truthy while inside the hack, is to
|
154
154
|
# prevent a scenario that might result in infinite recursion.
|
155
|
-
return send("#{type}_without_timing", file_path) if $require_bench_semaphore
|
155
|
+
return send("#{type}_without_timing", file_path, *args) if $require_bench_semaphore
|
156
156
|
|
157
157
|
short_type = type[0]
|
158
158
|
measure = RequireBench::INCLUDE_PATTERN && file_path.match?(RequireBench::INCLUDE_PATTERN)
|
@@ -160,22 +160,22 @@ if REQUIRE_BENCH_ENABLED
|
|
160
160
|
RequireBench::PRINTER.out_start(file, short_type) if RequireBench::LOG_START
|
161
161
|
if RequireBench::RESCUED_CLASSES.any?
|
162
162
|
begin
|
163
|
-
_require_bench_file(type, measure, skippy, file_path)
|
163
|
+
_require_bench_file(type, measure, skippy, file_path, *args)
|
164
164
|
rescue *RequireBench::RESCUED_CLASSES => e
|
165
|
-
RequireBench::PRINTER.out_error(e, file, short_type)
|
165
|
+
RequireBench::PRINTER.out_error(e, file, short_type, *args)
|
166
166
|
end
|
167
167
|
else
|
168
|
-
_require_bench_file(type, measure, skippy, file_path)
|
168
|
+
_require_bench_file(type, measure, skippy, file_path, *args)
|
169
169
|
end
|
170
170
|
end
|
171
171
|
|
172
|
-
def _require_bench_file(type, measure, skippy, file_path)
|
172
|
+
def _require_bench_file(type, measure, skippy, file_path, *args)
|
173
173
|
if !measure && skippy
|
174
|
-
send("#{type}_without_timing", file_path)
|
174
|
+
send("#{type}_without_timing", file_path, *args)
|
175
175
|
elsif RequireBench::INCLUDE_PATTERN.nil? || measure
|
176
|
-
RequireBench.
|
176
|
+
RequireBench.consume_with_timing(type, file_path, *args)
|
177
177
|
else
|
178
|
-
send("#{type}_without_timing", file_path)
|
178
|
+
send("#{type}_without_timing", file_path, *args)
|
179
179
|
end
|
180
180
|
end
|
181
181
|
end
|