Class: TestProf::EventProf::Configuration
- Inherits:
-
Object
- Object
- TestProf::EventProf::Configuration
- Defined in:
- lib/test_prof/event_prof.rb
Overview
EventProf configuration
Constant Summary collapse
- INSTRUMENTERS =
Map of supported instrumenters
{ active_support: 'ActiveSupport' }.freeze
Instance Attribute Summary collapse
-
#event ⇒ Object
Returns the value of attribute event.
-
#instrumenter ⇒ Object
Returns the value of attribute instrumenter.
-
#per_example ⇒ Object
Returns the value of attribute per_example.
-
#rank_by ⇒ Object
Returns the value of attribute rank_by.
-
#top_count ⇒ Object
Returns the value of attribute top_count.
Instance Method Summary collapse
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
- #per_example? ⇒ Boolean
- #resolve_instrumenter ⇒ Object
- #stamp? ⇒ Boolean
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
37 38 39 40 41 42 43 44 45 46 |
# File 'lib/test_prof/event_prof.rb', line 37 def initialize @event = ENV['EVENT_PROF'] @instrumenter = :active_support @top_count = (ENV['EVENT_PROF_TOP'] || 5).to_i @per_example = ENV['EVENT_PROF_EXAMPLES'] == '1' @rank_by = (ENV['EVENT_PROF_RANK'] || :time).to_sym @stamp = ENV['EVENT_PROF_STAMP'] RSpecStamp.config. = @stamp if stamp? end |
Instance Attribute Details
#event ⇒ Object
Returns the value of attribute event.
34 35 36 |
# File 'lib/test_prof/event_prof.rb', line 34 def event @event end |
#instrumenter ⇒ Object
Returns the value of attribute instrumenter.
34 35 36 |
# File 'lib/test_prof/event_prof.rb', line 34 def instrumenter @instrumenter end |
#per_example ⇒ Object
Returns the value of attribute per_example.
34 35 36 |
# File 'lib/test_prof/event_prof.rb', line 34 def per_example @per_example end |
#rank_by ⇒ Object
Returns the value of attribute rank_by.
34 35 36 |
# File 'lib/test_prof/event_prof.rb', line 34 def rank_by @rank_by end |
#top_count ⇒ Object
Returns the value of attribute top_count.
34 35 36 |
# File 'lib/test_prof/event_prof.rb', line 34 def top_count @top_count end |
Instance Method Details
#per_example? ⇒ Boolean
52 53 54 |
# File 'lib/test_prof/event_prof.rb', line 52 def per_example? per_example == true end |
#resolve_instrumenter ⇒ Object
56 57 58 59 60 61 62 63 |
# File 'lib/test_prof/event_prof.rb', line 56 def resolve_instrumenter return instrumenter if instrumenter.is_a?(Module) raise ArgumentError, "Unknown instrumenter: #{instrumenter}" unless INSTRUMENTERS.key?(instrumenter) Instrumentations.const_get(INSTRUMENTERS[instrumenter]) end |
#stamp? ⇒ Boolean
48 49 50 |
# File 'lib/test_prof/event_prof.rb', line 48 def stamp? !@stamp.nil? end |