Class: Trace2::ExecutableRunner

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

Overview

Class that runs the executable whose runtime will be used to analyze the relationship between classes

Instance Method Summary collapse

Constructor Details

#initialize(system_path: ENV['PATH'], argv: ARGV) ⇒ ExecutableRunner

Returns a new instance of ExecutableRunner.



7
8
9
10
# File 'lib/trace2/executable_runner.rb', line 7

def initialize(system_path: ENV['PATH'], argv: ARGV)
  @system_path = system_path
  @argv = argv
end

Instance Method Details

#run(executable, args) ⇒ Object



12
13
14
15
16
17
18
# File 'lib/trace2/executable_runner.rb', line 12

def run(executable, args)
  update_argv(args)
  executable_path = find_executable(executable)
  load(executable_path)
rescue SyntaxError
  raise SyntaxError, "#{executable} is not a valid Ruby script"
end