Sha256: f6c61eafd281d10625cbf402c46c3d267c5035d4dac72ce0fc63736b27c08c4e

Contents?: true

Size: 1.29 KB

Versions: 7

Compression:

Stored size: 1.29 KB

Contents

module Mutant
  class Strategy 
    include AbstractType, Adamantium::Flat, Equalizer.new

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

    # Initialize object
    #
    # @param [Config] config
    #
    # @return [undefined
    #
    # @api private
    #
    def initialize(config)
      @config = config
    end

    # Return output stream
    #
    # @return [IO]
    #
    # @api private
    #
    def output_stream
      config.reporter.output_stream
    end

    # Return error stream
    #
    # @return [IO]
    #
    # @api private
    #
    def error_stream
      config.reporter.error_stream
    end

    # Kill mutation
    #
    # @param [Mutation] mutation
    #
    # @return [Killer]
    #
    # @api private
    #
    def kill(mutation)
      killer.new(self, mutation)
    end

    # Return killer
    #
    # @return [Class:Killer]
    #
    # @api private
    #
    def killer
      self.class::KILLER
    end

    # Static strategies
    class Static < self
      include Equalizer.new

      # Always fail to kill strategy
      class Fail < self
        KILLER = Killer::Static::Fail
      end

      # Always succeed to kill strategy
      class Success < self
        KILLER = Killer::Static::Success
      end

    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
mutant-0.2.12 lib/mutant/strategy.rb
mutant-0.2.11 lib/mutant/strategy.rb
mutant-0.2.9 lib/mutant/strategy.rb
mutant-0.2.8 lib/mutant/strategy.rb
mutant-0.2.7 lib/mutant/strategy.rb
mutant-0.2.6 lib/mutant/strategy.rb
mutant-0.2.5 lib/mutant/strategy.rb