Sha256: 6c0152058f91896ffa23013f371707bbe7780fa08fd2f9897465037ce8ee1c34

Contents?: true

Size: 1.51 KB

Versions: 4

Compression:

Stored size: 1.51 KB

Contents

# frozen_string_literal: true

module Mutant
  class Mutation
    class Config
      include Anima.new(
        :ignore_patterns,
        :operators,
        :timeout
      )

      EMPTY = new(
        ignore_patterns: [],
        operators:       nil,
        timeout:         nil
      )

      DEFAULT = new(
        ignore_patterns: [],
        operators:       Mutation::Operators::Light.new,
        timeout:         nil
      )

      ignore_pattern = Transform::Block.capture('ignore pattern', &AST::Pattern.method(:parse))

      TRANSFORM = Transform::Sequence.new(
        steps: [
          Transform::Hash.new(
            optional: [
              Transform::Hash::Key.new(
                transform: Transform::Array.new(transform: ignore_pattern),
                value:     'ignore_patterns'
              ),
              Transform::Hash::Key.new(
                transform: Operators::TRANSFORM,
                value:     'operators'
              ),
              Transform::Hash::Key.new(
                transform: Transform::FLOAT,
                value:     'timeout'
              )
            ],
            required: []
          ),
          Transform::Hash::Symbolize.new,
          Transform::Success.new(block: EMPTY.method(:with))
        ]
      )

      def merge(other)
        with(
          ignore_patterns: other.ignore_patterns,
          operators:       other.operators || operators,
          timeout:         other.timeout || timeout
        )
      end
    end # Config
  end # Mutation
end # Mutant

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
mutant-0.11.25 lib/mutant/mutation/config.rb
mutant-0.11.24 lib/mutant/mutation/config.rb
mutant-0.11.23 lib/mutant/mutation/config.rb
mutant-0.11.22 lib/mutant/mutation/config.rb