require_bench 1.0.4.pre.alpha.5 → 1.0.4.pre.alpha.7

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f285dc3596cb6bdb255ca52e04672eb3db41190a00d539ccb95afb799ffe54b6
4
- data.tar.gz: 2e3516aabd3abd17ca1b5d2cb6446a2c35b8f4eb618072784147259b2d68b324
3
+ metadata.gz: 919c2f3cdaf47fedf1ca5771b0cc7b9cad4e42f33d86a53c1a6e90b858103414
4
+ data.tar.gz: 976f0fcb04c3099bd3e3bb4edce225f488b12f12833b5f838b0ba694f46a8924
5
5
  SHA512:
6
- metadata.gz: dad7f222558be2eed0b2c4ff1747417ccd6a3fed369a179b864947f874856c3168586552d97ea9d333e09757d8331c95ce805419688cb34b0a481dd2767497c1
7
- data.tar.gz: 945bec799822d77e515612adf017b79b298aafa9e2ae5d04265c1209051c9e6a2b6236ee7e3be0c131afc6f1ce59c329c93297ae7a00e928246ec742089b9ef9
6
+ metadata.gz: d3e46233df51c7263489a8851f4da8f96a64bb83e863819a119baf4674fe3f9f95f6b832e5edb3a8f3c8441a29b1c07bf8c4cdb841c94d0760b947c09ca8c17b
7
+ data.tar.gz: 84fae936ba01e83d7e6e6d4be55cfd77e0461812a0eb82924702c3082f86c3f4d173762d88891447867ecfb2666254d1e16d9e8c51df48e8a08c5fe88d06e816
@@ -4,7 +4,6 @@ class Printer
4
4
  # Log statement when a file starts loading
5
5
  def out_start(file, type)
6
6
  printf "🚥 [RequireBench-#{type}] 📖 %s 🚥\n", file
7
- rotate!
8
7
  end
9
8
 
10
9
  # Log statement when a file completed loading
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RequireBench
4
- VERSION = '1.0.4-alpha.5'
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.5
4
+ version: 1.0.4.pre.alpha.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Peter Boling