Class: TestProf::StackProf::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/test_prof/stack_prof.rb

Overview

StackProf configuration

Constant Summary collapse

FORMATS =
%w[html json].freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

Returns a new instance of Configuration.



28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/test_prof/stack_prof.rb', line 28

def initialize
  @mode = ENV.fetch("TEST_STACK_PROF_MODE", :wall).to_sym
  @target = (ENV["TEST_STACK_PROF"] == "boot") ? :boot : :suite
  @raw = ENV["TEST_STACK_PROF_RAW"] != "0"
  @format =
    if FORMATS.include?(ENV["TEST_STACK_PROF_FORMAT"])
      ENV["TEST_STACK_PROF_FORMAT"]
    else
      "json"
    end

  sample_interval = ENV["TEST_STACK_PROF_INTERVAL"].to_i
  @interval = (sample_interval > 0) ? sample_interval : nil
  @ignore_gc = !ENV["TEST_STACK_PROF_IGNORE_GC"].nil?
end

Instance Attribute Details

#formatObject

Returns the value of attribute format.



27
28
29
# File 'lib/test_prof/stack_prof.rb', line 27

def format
  @format
end

#ignore_gcObject

Returns the value of attribute ignore_gc.



27
28
29
# File 'lib/test_prof/stack_prof.rb', line 27

def ignore_gc
  @ignore_gc
end

#intervalObject

Returns the value of attribute interval.



27
28
29
# File 'lib/test_prof/stack_prof.rb', line 27

def interval
  @interval
end

#modeObject

Returns the value of attribute mode.



27
28
29
# File 'lib/test_prof/stack_prof.rb', line 27

def mode
  @mode
end

#rawObject

Returns the value of attribute raw.



27
28
29
# File 'lib/test_prof/stack_prof.rb', line 27

def raw
  @raw
end

#targetObject

Returns the value of attribute target.



27
28
29
# File 'lib/test_prof/stack_prof.rb', line 27

def target
  @target
end

Instance Method Details

#boot?Boolean

Returns:

  • (Boolean)


48
49
50
# File 'lib/test_prof/stack_prof.rb', line 48

def boot?
  target == :boot
end

#raw?Boolean

Returns:

  • (Boolean)


44
45
46
# File 'lib/test_prof/stack_prof.rb', line 44

def raw?
  @raw == true
end

#suite?Boolean

Returns:

  • (Boolean)


52
53
54
# File 'lib/test_prof/stack_prof.rb', line 52

def suite?
  target == :suite
end