Class: Orthoses::Railties::Mixin::MultiTracer::MiniTracer
- Inherits:
-
Object
- Object
- Orthoses::Railties::Mixin::MultiTracer::MiniTracer
- Defined in:
- lib/orthoses/railties/mixin.rb
Instance Attribute Summary collapse
-
#captures ⇒ Object
readonly
Returns the value of attribute captures.
Instance Method Summary collapse
-
#initialize ⇒ MiniTracer
constructor
A new instance of MiniTracer.
- #pop ⇒ Object
- #push ⇒ Object
- #trace(target:, &block) ⇒ Object
Constructor Details
#initialize ⇒ MiniTracer
Returns a new instance of MiniTracer.
20 21 22 23 24 25 26 27 28 |
# File 'lib/orthoses/railties/mixin.rb', line 20 def initialize @depth = [] @captures = [] @tp = TracePoint.new(:call) do |tp| if @depth.length > 0 @captures << [tp.self, tp.method_id, tp.binding.local_variable_get(:mods)] end end end |
Instance Attribute Details
#captures ⇒ Object (readonly)
Returns the value of attribute captures.
18 19 20 |
# File 'lib/orthoses/railties/mixin.rb', line 18 def captures @captures end |
Instance Method Details
#pop ⇒ Object
38 39 40 |
# File 'lib/orthoses/railties/mixin.rb', line 38 def pop @depth.pop end |
#push ⇒ Object
34 35 36 |
# File 'lib/orthoses/railties/mixin.rb', line 34 def push @depth << true end |
#trace(target:, &block) ⇒ Object
30 31 32 |
# File 'lib/orthoses/railties/mixin.rb', line 30 def trace(target:, &block) @tp.enable(target: target, &block) end |