Class: Rack::Bug::SpeedTracerPanel::Instrumentation
- Inherits:
-
Object
- Object
- Rack::Bug::SpeedTracerPanel::Instrumentation
- Defined in:
- lib/rack/bug/panels/speedtracer_panel/instrumentation.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.connect {|self.new| ... } ⇒ Object
14 15 16 |
# File 'lib/rack/bug/panels/speedtracer_panel/instrumentation.rb', line 14 def connect yield(self.new) end |
.get_instrument(const) ⇒ Object
10 11 12 |
# File 'lib/rack/bug/panels/speedtracer_panel/instrumentation.rb', line 10 def get_instrument(const) return @instruments[const] end |
Instance Method Details
#instrument(name) {|instrument| ... } ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/rack/bug/panels/speedtracer_panel/instrumentation.rb', line 19 def instrument(name) parts = name.split("::") begin const = parts.inject(Kernel) do |namespace, part| namespace.const_get(part) end rescue NameError => ex warn "Couldn't find #{name}" return nil end instrument = self.class.get_instrument(const) yield(instrument) if block_given? return instrument end |