81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
|
# File 'lib/hyper_trace/hyper_trace.rb', line 81
def hyper_trace(klass, *args, &block)
if args.count == 0
opts = { instrument: :all }
instrument_class = false
elsif args.first == :class
opts = args[1] || {}
instrument_class = true
else
opts = args.last || {}
instrument_class = false
end
begin
opts.is_a? Hash
rescue Exception
opts = Hash.new(opts)
end
config = Config.new(klass, instrument_class, opts, &block)
if config[:exclude]
exclusions[:instrumentation][klass] << opts[:exclude]
else
instrumentation_off(config)
selected_methods = if config[:instrument] == :all
all_methods(config)
else
Set.new config[:instrument]
end
selected_methods.each { |method| instrument_method(method, config) }
end
end
|