Class: Mutant::Runner

Inherits:
Object
  • Object
show all
Includes:
AbstractType, Adamantium::Flat
Defined in:
lib/mutant/runner.rb,
lib/mutant/runner/config.rb,
lib/mutant/runner/killer.rb,
lib/mutant/runner/subject.rb,
lib/mutant/runner/mutation.rb

Overview

Runner baseclass

Direct Known Subclasses

Config, Killer, Mutation, Subject

Defined Under Namespace

Classes: Config, Killer, Mutation, Subject

Constant Summary collapse

REGISTRY =
{}

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(config) ⇒ undefined

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Initialize object

Parameters:



82
83
84
85
86
87
88
89
90
91
92
# File 'lib/mutant/runner.rb', line 82

def initialize(config)
  @config = config
  @stop   = false
  @start  = Time.now
  @running = true
  progress(self)
  run
  @running = false
  progress(self)
  @end = Time.now
end

Instance Attribute Details

#configMutant::Config (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Return config

Returns:



72
73
74
# File 'lib/mutant/runner.rb', line 72

def config
  @config
end

Class Method Details

.run(config, object, *arguments) ⇒ Runner

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Run runner for object

Parameters:

  • config (Config)
  • object (Object)

Returns:



51
52
53
54
# File 'lib/mutant/runner.rb', line 51

def self.run(config, object, *arguments)
  handler = lookup(object.class)
  handler.new(config, object, *arguments)
end

Instance Method Details

#running?Boolean

Test if runner is running

Yeah this is evil. Should be refactored away

Returns:

  • (Boolean)


62
63
64
# File 'lib/mutant/runner.rb', line 62

def running?
  @running
end

#runtimeFloat

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Return runtime

Returns:

  • (Float)


114
115
116
# File 'lib/mutant/runner.rb', line 114

def runtime
  (@end || Time.now) - @start
end

#stop?true, false

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Test if runner should stop

Returns:

  • (true)

    if runner should stop

  • (false)

    otherwise



104
105
106
# File 'lib/mutant/runner.rb', line 104

def stop?
  @stop
end

#success?true, false

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Test if runner is successful

Returns:

  • (true)

    if successful

  • (false)

    otherwise



128
# File 'lib/mutant/runner.rb', line 128

abstract_method :success?