Class: Orthoses::Railties::Mixin::MultiTracer
- Inherits:
-
Object
- Object
- Orthoses::Railties::Mixin::MultiTracer
- Defined in:
- lib/orthoses/railties/mixin.rb
Defined Under Namespace
Modules: Hook Classes: MiniTracer
Instance Method Summary collapse
- #captures ⇒ Object
-
#initialize ⇒ MultiTracer
constructor
A new instance of MultiTracer.
- #trace ⇒ Object
Constructor Details
#initialize ⇒ MultiTracer
Returns a new instance of MultiTracer.
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
# File 'lib/orthoses/railties/mixin.rb', line 43 def initialize ::Module.prepend(Hook) @run = LazyTracePoint.new(:call, :return) do |tp| case tp.event when :call @include.push @extend.push @prepend.push when :return @include.pop @extend.pop @prepend.pop end end @include = MiniTracer.new @extend = MiniTracer.new @prepend = MiniTracer.new end |
Instance Method Details
#captures ⇒ Object
74 75 76 |
# File 'lib/orthoses/railties/mixin.rb', line 74 def captures @include.captures.concat(@extend.captures).concat(@prepend.captures) end |
#trace ⇒ Object
62 63 64 65 66 67 68 69 70 71 72 |
# File 'lib/orthoses/railties/mixin.rb', line 62 def trace @run.enable(target: 'ActiveSupport::LazyLoadHooks#execute_hook') do @include.trace(target: Hook.instance_method(:include)) do @extend.trace(target: Hook.instance_method(:extend)) do @prepend.trace(target: Hook.instance_method(:prepend)) do yield end end end end end |