Module: ActiveInteractionMapper

Defined in:
lib/active_interaction_mapper/tracer.rb,
lib/active_interaction_mapper.rb,
lib/active_interaction_mapper/filter.rb,
lib/active_interaction_mapper/output.rb,
lib/active_interaction_mapper/version.rb,
lib/active_interaction_mapper/output/dot.rb,
lib/active_interaction_mapper/output/text.rb,
lib/active_interaction_mapper/filter/start_at.rb,
lib/active_interaction_mapper/filter/active_interaction_filter.rb

Overview

require_relative ‘./filter/active_interaction_filter’

Defined Under Namespace

Modules: Filter, Output Classes: Error, Tracer

Constant Summary collapse

VERSION =
"0.1.2"

Class Method Summary collapse

Class Method Details

.trace(start_at: nil, output_image: true, folder_name: '', file_name: '', show_duplicated_path: false, &block) ⇒ Object



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/active_interaction_mapper.rb', line 16

def self.trace(start_at: nil, output_image: true, folder_name:'', file_name:'', show_duplicated_path: false, &block)
  filters = []
  filters << Filter::StartAt.new(start_at) if start_at
  filters << Filter::ActiveInteractionFilter.new

  if output_image
    output = ActiveInteractionMapper::Output::Dot.new(folder_name: folder_name, file_name: file_name, show_duplicated_path: show_duplicated_path)
  else
    output = ActiveInteractionMapper::Output::Text.new($stdout)
  end
  tracer = Tracer.new(filters: filters, output: output)
  tracer.enable

  begin
    yield
  ensure
    tracer.disable
  end
end