Class: TestProf::EventProf::ProfilersGroup

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

Overview

Multiple profilers wrapper

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(event:, **options) ⇒ ProfilersGroup

Returns a new instance of ProfilersGroup.



101
102
103
104
105
106
# File 'lib/test_prof/event_prof/profiler.rb', line 101

def initialize(event:, **options)
  events = event.split(",")
  @profilers = events.map do |ev|
    Profiler.new(event: ev, **options)
  end
end

Instance Attribute Details

#profilersObject (readonly)

Returns the value of attribute profilers.



99
100
101
# File 'lib/test_prof/event_prof/profiler.rb', line 99

def profilers
  @profilers
end

Instance Method Details

#eachObject



108
109
110
111
112
113
114
# File 'lib/test_prof/event_prof/profiler.rb', line 108

def each
  if block_given?
    @profilers.each(&Proc.new)
  else
    @profilers.each
  end
end

#eventsObject



116
117
118
# File 'lib/test_prof/event_prof/profiler.rb', line 116

def events
  @profilers.map(&:event)
end