Module: SourceRoute

Extended by:
SourceRoute
Included in:
SourceRoute
Defined in:
lib/source_route.rb,
lib/source_route/version.rb,
lib/source_route/wrapper.rb,
lib/source_route/tp_filter.rb,
lib/source_route/tp_result.rb,
lib/source_route/formats/html.rb,
lib/source_route/generate_result.rb,
lib/source_route/tp_result_chain.rb

Defined Under Namespace

Modules: Formats Classes: GenerateResult, Logger, TpFilter, TpResult, TpResultChain, Wrapper

Constant Summary collapse

VERSION =
"0.2.0"

Instance Method Summary collapse

Instance Method Details

#disableObject



46
47
48
# File 'lib/source_route.rb', line 46

def disable
  wrapper.tp.disable
end

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



50
51
52
53
54
55
56
57
58
59
60
61
# File 'lib/source_route.rb', line 50

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

  if match
    wrapper.condition.method_id(match)
    wrapper.condition.defined_class(match)
  end

  wrapper.condition.instance_eval(&block) if block_given?

  wrapper.trace
end

#output_htmlObject



76
77
78
79
# File 'lib/source_route.rb', line 76

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

#resetObject



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

def reset
  wrapper.reset
end

#trace(opt, &block) ⇒ Object



63
64
65
66
67
68
69
70
71
72
73
74
# File 'lib/source_route.rb', line 63

def trace(opt, &block)
  opt[:output_format] ||= :test
  wrapper.reset
  opt.each do |k, v|
    wrapper.condition.send(k, v)
  end

  wrapper.trace
  yield
  wrapper.tp.disable
  SourceRoute.output_html if opt[:output_format].to_sym == :html
end

#wrapperObject



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

def wrapper
  @@wrapper ||= Wrapper.instance
end