Class: TestProf::TPSProf::Configuration

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

Returns a new instance of Configuration.



37
38
39
40
41
42
43
44
45
46
47
48
49
50
# File 'lib/test_prof/tps_prof.rb', line 37

def initialize
  @mode = (ENV["TPS_PROF_MODE"] || ((ENV["TPS_PROF"] == "strict") ? :strict : :profile)).to_sym
  @top_count = ENV["TPS_PROF_COUNT"]&.to_i || ((ENV["TPS_PROF"].to_i > 1) ? ENV["TPS_PROF"].to_i : nil) || 10

  @min_examples_count = ENV.fetch("TPS_PROF_MIN_EXAMPLES", 10).to_i
  @min_group_time = ENV.fetch("TPS_PROF_MIN_TIME", 5).to_i
  @min_target_tps = ENV.fetch("TPS_PROF_TARGET_TPS", 30).to_i

  @max_examples_count = ENV["TPS_PROF_MAX_EXAMPLES"]&.to_i
  @max_group_time = ENV["TPS_PROF_MAX_TIME"]&.to_i
  @min_tps = ENV["TPS_PROF_MIN_TPS"]&.to_i

  @reporter = resolve_reporter(ENV["TPS_PROF_FORMAT"])
end

Instance Attribute Details

#custom_strict_handlerObject (readonly)

Returns the value of attribute custom_strict_handler.



35
36
37
# File 'lib/test_prof/tps_prof.rb', line 35

def custom_strict_handler
  @custom_strict_handler
end

#max_examples_countObject

Thresholds



26
27
28
# File 'lib/test_prof/tps_prof.rb', line 26

def max_examples_count
  @max_examples_count
end

#max_group_timeObject

Thresholds



26
27
28
# File 'lib/test_prof/tps_prof.rb', line 26

def max_group_time
  @max_group_time
end

#min_examples_countObject

Thresholds



26
27
28
# File 'lib/test_prof/tps_prof.rb', line 26

def min_examples_count
  @min_examples_count
end

#min_group_timeObject

Thresholds



26
27
28
# File 'lib/test_prof/tps_prof.rb', line 26

def min_group_time
  @min_group_time
end

#min_target_tpsObject

Thresholds



26
27
28
# File 'lib/test_prof/tps_prof.rb', line 26

def min_target_tps
  @min_target_tps
end

#min_tpsObject

Thresholds



26
27
28
# File 'lib/test_prof/tps_prof.rb', line 26

def min_tps
  @min_tps
end

#modeObject

Returns the value of attribute mode.



23
24
25
# File 'lib/test_prof/tps_prof.rb', line 23

def mode
  @mode
end

#reporterObject

Returns the value of attribute reporter.



23
24
25
# File 'lib/test_prof/tps_prof.rb', line 23

def reporter
  @reporter
end

#top_countObject

Returns the value of attribute top_count.



23
24
25
# File 'lib/test_prof/tps_prof.rb', line 23

def top_count
  @top_count
end

Instance Method Details

#strict_handlerObject



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

def strict_handler
  @strict_handler ||= method(:default_strict_handler)
end

#strict_handler=(val) ⇒ Object



56
57
58
59
# File 'lib/test_prof/tps_prof.rb', line 56

def strict_handler=(val)
  @strict_handler = val
  @custom_strict_handler = true
end