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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 19377882af9bd069ef96a78e718e948231ca159dbd5c6b1592d256fa2cfc2526
4
- data.tar.gz: 5354d7d662c5ed4cfd0a447ada65e0e124adad2cef568aad0e3990bcb14ccd13
3
+ metadata.gz: 919c2f3cdaf47fedf1ca5771b0cc7b9cad4e42f33d86a53c1a6e90b858103414
4
+ data.tar.gz: 976f0fcb04c3099bd3e3bb4edce225f488b12f12833b5f838b0ba694f46a8924
5
5
  SHA512:
6
- metadata.gz: d216841c7a42449a4d5d0e64e80c534b1a61e3027ffc889d2dc8de7b7cb8bec7ce8351b1547f3ac35891ab8db8966a87411723d3f53fb04924557e55960b24d2
7
- data.tar.gz: a742cfbd360de6bebc5dd34f90a51c0328a11073ca48739912557bcae17e42ce6fc0543a680d89a31d4620287dc62ec73b54b3aa91d00bb5f7be1c16261045ae
6
+ metadata.gz: d3e46233df51c7263489a8851f4da8f96a64bb83e863819a119baf4674fe3f9f95f6b832e5edb3a8f3c8441a29b1c07bf8c4cdb841c94d0760b947c09ca8c17b
7
+ data.tar.gz: 84fae936ba01e83d7e6e6d4be55cfd77e0461812a0eb82924702c3082f86c3f4d173762d88891447867ecfb2666254d1e16d9e8c51df48e8a08c5fe88d06e816
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RequireBench
4
- VERSION = '1.0.4-alpha.6'
4
+ VERSION = '1.0.4-alpha.7'
5
5
  end
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.send('consume_with_timing', type, file_path)
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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: require_bench
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.4.pre.alpha.6
4
+ version: 1.0.4.pre.alpha.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Peter Boling