Skip to content

Commit fb7cda2

Browse files
morgothfnando
authored andcommitted
Remove benchmark gem
It issues a deprecation warning: benchmark was loaded from the standard library, but will no longer be part of the default gems starting from Ruby 3.5.0. Since the used method is very simple, there is no need for dependency
1 parent 9f99172 commit fb7cda2

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

lib/i18n-js/cli/export_command.rb

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
# frozen_string_literal: true
22

3-
require "benchmark"
4-
53
module I18nJS
64
class CLI
75
class ExportCommand < Command
@@ -69,7 +67,7 @@ class ExportCommand < Command
6967
)
7068
end
7169

72-
time = Benchmark.realtime do
70+
time = benchmark_realtime do
7371
load_require_file!(require_file) if require_file
7472
I18nJS.call(config_file:)
7573
end
@@ -90,6 +88,12 @@ class ExportCommand < Command
9088
options[:config_file] ||= config_file if File.file?(config_file)
9189
options[:require_file] ||= require_file if File.file?(require_file)
9290
end
91+
92+
private def benchmark_realtime
93+
start = Process.clock_gettime(Process::CLOCK_MONOTONIC)
94+
yield
95+
Process.clock_gettime(Process::CLOCK_MONOTONIC) - start
96+
end
9397
end
9498
end
9599
end

0 commit comments

Comments
 (0)