Skip to content

Instantly share code, notes, and snippets.

@ryopeko
Last active December 29, 2015 19:59
Show Gist options
  • Save ryopeko/7720428 to your computer and use it in GitHub Desktop.
Save ryopeko/7720428 to your computer and use it in GitHub Desktop.
require 'tapp/configuration'
require 'tapp/deprecated'
require 'tapp/object_extension'
require 'tapp/printer'
class TraceDumper
attr_accessor :trace_point, :depth
def initialize
@depth = 0
@trace_point = TracePoint.new(:call, :return) do |tp|
case tp.event
when :call
p (" " * @depth) + "#{tp.defined_class}, #{tp.method_id}"
@depth += 1
when :return
@depth -= 1 if @depth > 0
end
end
end
def enable
@trace_point.enable
end
def disable
@trace_point.disable
end
end
TraceDumper.new.enable
module Tapp
extend Deprecated
class << self
def config
@config ||= Tapp::Configuration.new
end
def configure(&block)
config.tap(&block)
end
end
end
Object.__send__ :include, Tapp::ObjectExtension
"#<Class:Tapp>, config"
" Tapp::Configuration, initialize"
" Tapp::Configuration, reset"
"Tapp::ObjectExtension, tapp"
" #<Class:Tapp>, config"
" #<Class:Tapp::Printer>, instance"
" Kernel, require"
" #<Class:Gem>, find_unresolved_default_spec"
" #<Class:Gem>, suffixes"
" #<Class:Gem::Specification>, unresolved_deps"
" Kernel, require"
" #<Class:Gem>, find_unresolved_default_spec"
" #<Class:Gem>, suffixes"
" #<Class:Gem::Specification>, unresolved_deps"
" Kernel, require"
" #<Class:Gem>, find_unresolved_default_spec"
" #<Class:Gem>, suffixes"
" #<Class:Gem::Specification>, unresolved_deps"
" Singleton::SingletonClassMethods, inherited"
" #<Class:Singleton>, __init__"
" #<Class:Tapp::Printer::PrettyPrint>, instance"
" Tapp::Printer::PrettyPrint, print"
" Kernel, pp"
" #<Class:PP>, pp"
" PrettyPrint, initialize"
" PrettyPrint::Group, initialize"
" PrettyPrint::GroupQueue, initialize"
" PrettyPrint::GroupQueue, enq"
" PP::PPMethods, guard_inspect_key"
" PP::PPMethods, pp"
" PP::PPMethods, check_inspect_key"
" PP::PPMethods, push_inspect_key"
" PrettyPrint, group"
" PrettyPrint, text"
" PrettyPrint, group_sub"
" PrettyPrint::Group, initialize"
" PrettyPrint::GroupQueue, enq"
" PrettyPrint, nest"
" PP::ObjectMixin, pretty_print"
" PrettyPrint, text"
main" PrettyPrint::GroupQueue, delete"
" PrettyPrint, text"
" PP::PPMethods, pop_inspect_key"
" PrettyPrint, flush"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment