Class: Trace2::Runner

Inherits:
Object
  • Object
show all
Defined in:
lib/trace2/runner.rb

Overview

Base class for trace2’s executable

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ Runner

Returns a new instance of Runner.



13
14
15
16
17
18
19
20
21
22
23
# File 'lib/trace2/runner.rb', line 13

def initialize(options)
  @args = options[:args]
  @executable = options[:executable]
  @output_path = options.fetch(:output_path)
  @executable_runner = options[:executable_runner] || ExecutableRunner.new
  @render_graph_automatically = options.fetch(:automatic_render, false)
  @graph_format = options[:graph_format]
  @filter_path = options[:filter_path]
  @dot_wrapper = options.fetch(:dot_wrapper, DotWrapper.new)
  build_class_lister(options)
end

Class Method Details

.run(args: ARGV, options: Options.new) ⇒ Object



8
9
10
11
# File 'lib/trace2/runner.rb', line 8

def self.run(args: ARGV, options: Options.new)
  options_hash = options.parse(args)
  new(options_hash).run
end

Instance Method Details

#runObject



25
26
27
28
29
# File 'lib/trace2/runner.rb', line 25

def run
  at_exit { end_class_listing }
  class_lister.enable
  executable_runner.run(executable, args)
end