Class: PigCI::ProfilerEngine

Inherits:
Object
  • Object
show all
Defined in:
lib/pig_ci/profiler_engine.rb

Direct Known Subclasses

Rails

Defined Under Namespace

Classes: Rails

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(profilers: nil, reports: nil) ⇒ ProfilerEngine

Returns a new instance of ProfilerEngine.


4
5
6
7
8
# File 'lib/pig_ci/profiler_engine.rb', line 4

def initialize(profilers: nil, reports: nil)
  @profilers = profilers || []
  @reports = reports || []
  @request_captured = false
end

Instance Attribute Details

#profilersObject

Returns the value of attribute profilers


2
3
4
# File 'lib/pig_ci/profiler_engine.rb', line 2

def profilers
  @profilers
end

#reportsObject

Returns the value of attribute reports


2
3
4
# File 'lib/pig_ci/profiler_engine.rb', line 2

def reports
  @reports
end

#request_capturedObject

Returns the value of attribute request_captured


2
3
4
# File 'lib/pig_ci/profiler_engine.rb', line 2

def request_captured
  @request_captured
end

#request_keyObject

Returns the value of attribute request_key


2
3
4
# File 'lib/pig_ci/profiler_engine.rb', line 2

def request_key
  @request_key
end

Instance Method Details

#request_captured!Object


18
19
20
# File 'lib/pig_ci/profiler_engine.rb', line 18

def request_captured!
  @request_captured = true
end

#request_captured?Boolean

Returns:

  • (Boolean)

14
15
16
# File 'lib/pig_ci/profiler_engine.rb', line 14

def request_captured?
  @request_captured
end

#request_key?Boolean

Returns:

  • (Boolean)

10
11
12
# File 'lib/pig_ci/profiler_engine.rb', line 10

def request_key?
  !@request_key.nil? && @request_key != ''
end

#setup!Object


22
23
24
25
26
27
28
29
30
31
# File 'lib/pig_ci/profiler_engine.rb', line 22

def setup!
  Dir.mkdir(PigCI.tmp_directory) unless File.exist?(PigCI.tmp_directory)

  yield if block_given?

  profilers.collect(&:setup!)

  # Attach listeners to the rails events.
  attach_listeners!
end