Module: DiverDown::Trace::RedefineRubyMethods
- Defined in:
- lib/diver_down/trace/redefine_ruby_methods.rb
Overview
Tracepoint traces only ruby-lang calls because tracing c-lang calls is very slow. In this case, methods such as new will not be traceable under normal circumstances, so at a minimum, redefine them in ruby and hack them so that they can be traced.
Do not use this in a production environment.
Defined Under Namespace
Classes: RubyMethods
Constant Summary collapse
- DEFAULT_METHODS =
{ Module => { singleton: %i[name], instance: [], }, Class => { singleton: %i[name allocate new], instance: [], }, }.freeze
Class Method Summary collapse
Class Method Details
.redefine_c_methods(map = DEFAULT_METHODS) ⇒ Object
57 58 59 60 61 |
# File 'lib/diver_down/trace/redefine_ruby_methods.rb', line 57 def self.redefine_c_methods(map = DEFAULT_METHODS) map.each do |m, method_names| m.prepend(RubyMethods.new(method_names[:singleton], method_names[:instance])) end end |