Sha256: f18a51c3f77c2a13aa49d38eb29a7b973dedb66c46e2389a04d4ebe7ad52ffaf

Contents?: true

Size: 1.45 KB

Versions: 13

Compression:

Stored size: 1.45 KB

Contents

module Mutant
  # Runner baseclass
  class Runner
    include Adamantium::Flat, AbstractType, Equalizer.new(:config)
    extend MethodObject

    # Return config
    #
    # @return [Mutant::Config]
    #
    # @api private
    #
    attr_reader :config

    # Initialize object
    #
    # @param [Config] config
    #
    # @return [undefined]
    #
    # @api private
    #
    def initialize(config)
      @config = config
      @start = Time.now
      run
      @end = Time.now
    end

    # Return runtime
    #
    # @return [Float]
    #
    # @api private
    #
    def runtime
      @end - @start
    end
    memoize :runtime

    # Test if runner failed
    #
    # @return [true]
    #   if failed
    #
    # @return [false]
    #   otherwise
    #
    # @api private
    #
    def failed?
      !success?
    end

    # Test if runner is successful
    #
    # @return [true]
    #   if successful
    #
    # @return [false]
    #   otherwise
    #
    # @api private
    #
    abstract_method :success?

    # Return reporter
    #
    # @return [Reporter]
    #
    # @api private
    #
    def reporter
      config.reporter
    end

  private

    # Perform operation
    #
    # @return [undefined]
    #
    # @api private
    #
    abstract_method :run

    # Return reporter
    #
    # @param [Object] object
    #
    # @return [undefined]
    #
    # @api private
    #
    def report(object)
      reporter.report(object)
    end

  end # Runner
end # Mutant

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
mutant-0.3.0.beta14 lib/mutant/runner.rb
mutant-0.3.0.beta13 lib/mutant/runner.rb
mutant-0.3.0.beta12 lib/mutant/runner.rb
mutant-0.3.0.beta11 lib/mutant/runner.rb
mutant-0.3.0.beta10 lib/mutant/runner.rb
mutant-0.3.0.beta9 lib/mutant/runner.rb
mutant-0.3.0.beta8 lib/mutant/runner.rb
mutant-0.3.0.beta7 lib/mutant/runner.rb
mutant-0.3.0.beta6 lib/mutant/runner.rb
mutant-0.3.0.beta5 lib/mutant/runner.rb
mutant-0.3.0.beta4 lib/mutant/runner.rb
mutant-0.3.0.beta3 lib/mutant/runner.rb
mutant-0.3.0.beta2 lib/mutant/runner.rb