Class: RubyMemcheck::RubyRunner

Inherits:
Object
  • Object
show all
Defined in:
lib/ruby_memcheck/ruby_runner.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(*args) ⇒ RubyRunner

Returns a new instance of RubyRunner.



8
9
10
11
12
13
14
15
# File 'lib/ruby_memcheck/ruby_runner.rb', line 8

def initialize(*args)
  @configuration =
    if !args.empty? && args[0].is_a?(Configuration)
      args.shift
    else
      RubyMemcheck.default_configuration
    end
end

Instance Attribute Details

#configurationObject (readonly)

Returns the value of attribute configuration.



5
6
7
# File 'lib/ruby_memcheck/ruby_runner.rb', line 5

def configuration
  @configuration
end

#reporterObject (readonly)

Returns the value of attribute reporter.



6
7
8
# File 'lib/ruby_memcheck/ruby_runner.rb', line 6

def reporter
  @reporter
end

Instance Method Details

#run(*args, **options) ⇒ Object



17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/ruby_memcheck/ruby_runner.rb', line 17

def run(*args, **options)
  command = configuration.command(args.map { |a| Shellwords.escape(a) })

  @reporter = TestTaskReporter.new(configuration)

  @reporter.setup

  system(command, options)
  exit_code = $CHILD_STATUS.exitstatus

  @reporter.report_valgrind_errors

  exit_code
end