Module: Frequent
- Defined in:
- lib/frequent.rb,
lib/frequent.rb,
lib/frequent.rb
Defined Under Namespace
Modules: Deferred
Classes: Probe
Constant Summary
collapse
- VERSION =
0.1
- ProbeNameError =
Class.new(StandardError)
Class Method Summary
collapse
Class Method Details
.constantize(name) ⇒ Object
18
19
20
21
22
23
24
25
26
27
28
|
# File 'lib/frequent.rb', line 18
def self.constantize(name)
names = name.split('::')
names.shift if names.first == ''
constant = Object
until names.empty?
n = names.shift
return nil unless constant.const_defined?(n)
constant = constant.const_get(n, false)
end
constant
end
|
.instrument(name) ⇒ Object
6
7
8
9
10
11
12
13
14
15
16
|
# File 'lib/frequent.rb', line 6
def self.instrument(name)
probe = Frequent::Probe.new(name)
probes[name] = probe
Frequent::Deferred.enable! unless probe.enabled?
if block_given?
yield
probe.disable!
probes.delete(name)
end
probe
end
|
.probes ⇒ Object
30
31
32
|
# File 'lib/frequent.rb', line 30
def self.probes
@probes ||= {}
end
|