0.0
No commit activity in last 3 years
No release in over 3 years
indented-tracer
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies
 Project Readme

#Introducing the Indented-tracer gem

The following example shows how to trace the method calls in a class using the indented-tracer gem. The indented-tracer gem uses the Tracer class to detect when a method is called in the context of the class we are interested in.

require 'indented-tracer'

class Light
  def on
    puts 'I see the light'
  end
end

class Fun

  def initialize()
    @led = Light.new
  end

  def breathe()
    puts 'breathing in'
  end

  def moo(s)
    breathe
    @led.on
    puts 'you said moo ' + s
  end

  def bar()
    puts 'bar'
  end
end

it = IndentedTracer.new
it.classes = ['Fun', 'Light']
it.on

fun = Fun.new

fun.moo ' x 2'
fun.bar
it.off
puts it.log

output:

<?polyrex schema='session/entry[classname, methodname]' delimiter='#'?>
Fun#initialize
Fun#moo
  Fun#breathe
  Light#on
Fun#bar

Resources