Class: TestProf::RubyProf::Configuration
- Inherits:
-
Object
- Object
- TestProf::RubyProf::Configuration
- Defined in:
- lib/test_prof/ruby_prof.rb
Overview
RubyProf configuration
Constant Summary collapse
- ELIMINATE_METHODS =
Default list of methods to exclude from profile. Contains a lot of RSpec stuff.
[ /instance_exec/, /ExampleGroup>?#run/, /Procsy/, /AroundHook#execute_with/, /HookCollections/, /Array#(map|each)/ ].freeze
- PRINTERS =
{ 'flat' => 'FlatPrinter', 'flat_wln' => 'FlatWithLineNumbers', 'graph' => 'GraphPrinter', 'graph_html' => 'GraphHtmlPrinter', 'dot' => 'DotPrinter', '.' => 'DotPrinter', 'call_stack' => 'CallStackPrinter', 'call_tree' => 'CallTreePrinter' }.freeze
Instance Attribute Summary collapse
-
#eliminate_methods ⇒ Object
Returns the value of attribute eliminate_methods.
-
#include_threads ⇒ Object
Returns the value of attribute include_threads.
-
#min_percent ⇒ Object
Returns the value of attribute min_percent.
-
#mode ⇒ Object
Returns the value of attribute mode.
-
#printer ⇒ Object
Returns the value of attribute printer.
Instance Method Summary collapse
- #eliminate_methods? ⇒ Boolean
- #include_threads? ⇒ Boolean
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
-
#resolve_printer ⇒ Object
Returns an array of printer type (ID) and class.
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
50 51 52 53 54 55 56 |
# File 'lib/test_prof/ruby_prof.rb', line 50 def initialize @printer = ENV.fetch('TEST_RUBY_PROF_PRINTER', :call_stack).to_sym @mode = ENV.fetch('TEST_RUBY_PROF_MODE', :wall).to_sym @min_percent = 1 @include_threads = false @eliminate_methods = ELIMINATE_METHODS end |
Instance Attribute Details
#eliminate_methods ⇒ Object
Returns the value of attribute eliminate_methods.
47 48 49 |
# File 'lib/test_prof/ruby_prof.rb', line 47 def eliminate_methods @eliminate_methods end |
#include_threads ⇒ Object
Returns the value of attribute include_threads.
47 48 49 |
# File 'lib/test_prof/ruby_prof.rb', line 47 def include_threads @include_threads end |
#min_percent ⇒ Object
Returns the value of attribute min_percent.
47 48 49 |
# File 'lib/test_prof/ruby_prof.rb', line 47 def min_percent @min_percent end |
#mode ⇒ Object
Returns the value of attribute mode.
47 48 49 |
# File 'lib/test_prof/ruby_prof.rb', line 47 def mode @mode end |
#printer ⇒ Object
Returns the value of attribute printer.
47 48 49 |
# File 'lib/test_prof/ruby_prof.rb', line 47 def printer @printer end |
Instance Method Details
#eliminate_methods? ⇒ Boolean
62 63 64 65 |
# File 'lib/test_prof/ruby_prof.rb', line 62 def eliminate_methods? !eliminate_methods.nil? && !eliminate_methods.empty? end |
#include_threads? ⇒ Boolean
58 59 60 |
# File 'lib/test_prof/ruby_prof.rb', line 58 def include_threads? include_threads == true end |
#resolve_printer ⇒ Object
Returns an array of printer type (ID) and class.
68 69 70 71 72 73 74 75 76 77 |
# File 'lib/test_prof/ruby_prof.rb', line 68 def resolve_printer return ['custom', printer] if printer.is_a?(Module) type = printer.to_s raise ArgumentError, "Unknown printer: #{type}" unless PRINTERS.key?(type) [type, ::RubyProf.const_get(PRINTERS[type])] end |