Module: SourceRoute

Extended by:
SourceRoute
Included in:
SourceRoute
Defined in:
lib/source_route.rb,
lib/source_route/proxy.rb,
lib/source_route/config.rb,
lib/source_route/version.rb,
lib/source_route/tp_result.rb,
lib/source_route/trace_chain.rb,
lib/source_route/formats/html.rb,
lib/source_route/trace_filter.rb,
lib/source_route/generate_result.rb

Defined Under Namespace

Modules: Formats, ParamsConfigParser Classes: BlockConfigParser, Config, GenerateResult, Proxy, TpResult, TraceChain, TraceFilter

Constant Summary collapse

TRACE_FILTER =
[:defined_class, :method_id, :path, :lineno].freeze
TRACE_FILTER_METHODS =
(TRACE_FILTER + TRACE_FILTER.map { |tpf| "#{tpf}_not".to_sym }).freeze
VERSION =
"0.6.0"

Instance Method Summary collapse

Instance Method Details

#disableObject



46
47
48
49
50
51
52
# File 'lib/source_route.rb', line 46

def disable
  if proxy.tp.nil?
    puts 'Error: You try to call disable on nil object, do you define SourceRoute ?'
  else
    proxy.tp.disable
  end
end

#enable(match = nil, &block) ⇒ Object



54
55
56
57
58
59
60
# File 'lib/source_route.rb', line 54

def enable(match = nil, &block)
  proxy.reset

  proxy.config = BlockConfigParser.new.run(match, &block)

  proxy.trace
end

#output_htmlObject



71
72
73
74
# File 'lib/source_route.rb', line 71

def output_html
  SourceRoute.disable
  SourceRoute::Formats::Html.slim_render(proxy)
end

#proxyObject



38
39
40
# File 'lib/source_route.rb', line 38

def proxy
  @@proxy ||= Proxy.instance
end

#resetObject



42
43
44
# File 'lib/source_route.rb', line 42

def reset
  proxy.reset
end

#trace(opt, &block) ⇒ Object



62
63
64
65
66
67
68
69
# File 'lib/source_route.rb', line 62

def trace(opt, &block)
  proxy.reset
  proxy.config = ParamsConfigParser.run(opt)
  proxy.trace
  yield
  proxy.tp.disable
  SourceRoute.output_html if proxy.config.output_format == :html
end