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.



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

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
      'html'
    end
end

Instance Attribute Details

#formatObject

Returns the value of attribute format.



29
30
31
# File 'lib/test_prof/stack_prof.rb', line 29

def format
  @format
end

#intervalObject

Returns the value of attribute interval.



29
30
31
# File 'lib/test_prof/stack_prof.rb', line 29

def interval
  @interval
end

#modeObject

Returns the value of attribute mode.



29
30
31
# File 'lib/test_prof/stack_prof.rb', line 29

def mode
  @mode
end

#rawObject

Returns the value of attribute raw.



29
30
31
# File 'lib/test_prof/stack_prof.rb', line 29

def raw
  @raw
end

#targetObject

Returns the value of attribute target.



29
30
31
# File 'lib/test_prof/stack_prof.rb', line 29

def target
  @target
end

Instance Method Details

#boot?Boolean

Returns:

  • (Boolean)


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

def boot?
  target == :boot
end

#raw?Boolean

Returns:

  • (Boolean)


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

def raw?
  @raw == true
end

#suite?Boolean

Returns:

  • (Boolean)


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

def suite?
  target == :suite
end