Class: ApiHeaderOptimizer::Optimizer

Inherits:
Object
  • Object
show all
Defined in:
lib/api_header_optimizer/optimizer.rb

Instance Method Summary collapse

Constructor Details

#initialize(uri, headers) ⇒ Optimizer

Returns a new instance of Optimizer.



5
6
7
8
9
# File 'lib/api_header_optimizer/optimizer.rb', line 5

def initialize(uri, headers)
  @uri = uri
  @headers = headers
  @tester = Tester.new(uri, headers)
end

Instance Method Details

#optimizeObject



11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/api_header_optimizer/optimizer.rb', line 11

def optimize
  puts "Starting optimization..."
  @tester.test_combinations

  optimal_headers = find_optimal_headers
  if optimal_headers.empty?
    puts "No optimal headers found."
  else
    puts "Optimal headers found: #{optimal_headers}"
  end
  optimal_headers
end