Module: CodeMapper

Defined in:
lib/code_mapper.rb,
lib/code_mapper/filter.rb,
lib/code_mapper/output.rb,
lib/code_mapper/tracer.rb,
lib/code_mapper/version.rb,
lib/code_mapper/output/dot.rb,
lib/code_mapper/output/text.rb,
lib/code_mapper/filter/callee.rb,
lib/code_mapper/filter/start_at.rb,
lib/code_mapper/filter/max_depth.rb

Defined Under Namespace

Modules: Filter, Output Classes: Tracer

Constant Summary collapse

VERSION =
"0.1.0"

Class Method Summary collapse

Class Method Details

.trace(filter: nil, start_at: nil, max_depth: nil, output: CodeMapper::Output::Text.new($stdout), &block) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/code_mapper.rb', line 10

def self.trace(filter: nil, start_at: nil, max_depth: nil, output: CodeMapper::Output::Text.new($stdout), &block)
  filters = []
  filters << Filter::Callee.new(filter) if filter
  filters << Filter::StartAt.new(start_at) if start_at
  filters << Filter::MaxDepth.new(max_depth) if max_depth

  tracer = Tracer.new(filters: filters, output: output)
  tracer.enable

  begin
    yield
  ensure
    tracer.disable
  end
end