Class: Ace::Compressor::CLI::Commands::Benchmark

Inherits:
Support::Cli::Command
  • Object
show all
Includes:
Support::Cli::Base
Defined in:
lib/ace/compressor/cli/commands/benchmark.rb

Instance Method Summary collapse

Instance Method Details

#call(**options) ⇒ Object



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/ace/compressor/cli/commands/benchmark.rb', line 20

def call(**options)
  sources = normalize_sources(options[:sources] || [])
  if sources.empty?
    raise Ace::Support::Cli::Error,
      "Missing input path. Usage: ace-compressor benchmark <file-or-dir> [more-paths...]"
  end

  runner = Ace::Compressor::Organisms::BenchmarkRunner.new(
    sources,
    modes: options[:modes],
    format: options[:format],
    verbose: !!options[:verbose]
  )
  report = runner.call
  puts runner.render(report)
  0
rescue Ace::Compressor::Error => e
  raise Ace::Support::Cli::Error, e.message
end