Class: DevSuite::Performance::Analyzer

Inherits:
Object
  • Object
show all
Defined in:
lib/dev_suite/performance/analyzer.rb

Instance Method Summary collapse

Constructor Details

#initialize(description: "Block") ⇒ Analyzer

Returns a new instance of Analyzer.



6
7
8
9
# File 'lib/dev_suite/performance/analyzer.rb', line 6

def initialize(description: "Block")
  @description = description
  @profiler_manager = ProfilerManager.new
end

Instance Method Details

#analyze(&block) ⇒ Object

Analyzes the performance of the given block

Parameters:

  • block (Proc)

    The block to be analyzed

Raises:

  • (ArgumentError)

    If no block is given



14
15
16
17
18
19
20
# File 'lib/dev_suite/performance/analyzer.rb', line 14

def analyze(&block)
  raise ArgumentError, "No block given" unless block_given?

  outcome = @profiler_manager.run(&block)
  generate_report(@profiler_manager.results)
  outcome
end