Sha256: 1e46ca5f47a773b506dcee698afa8eea18844c369a813e2e4201ddfd428e5588

Contents?: true

Size: 1.02 KB

Versions: 17

Compression:

Stored size: 1.02 KB

Contents

# frozen_string_literal: true

module Mutant
  class Mutator
    class Util

      # Mutators that mutates an array of inputs
      class Array < self

        # Element presence mutator
        class Presence < Util

        private

          # Emit element presence mutations
          #
          # @return [undefined]
          def dispatch
            input.each_index do |index|
              dup = dup_input
              dup.delete_at(index)
              emit(dup)
            end
          end

        end # Presence

        # Array element mutator
        class Element < Util

        private

          # Emit mutations
          #
          # @return [undefined]
          def dispatch
            input.each_with_index do |element, index|
              Mutator.mutate(element).each do |mutation|
                dup = dup_input
                dup[index] = mutation
                emit(dup)
              end
            end
          end

        end # Element
      end # Array
    end # Util
  end # Mutator
end # Mutant

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
mutant-0.9.8 lib/mutant/mutator/util/array.rb
mutant-0.9.7 lib/mutant/mutator/util/array.rb
mutant-0.9.6 lib/mutant/mutator/util/array.rb
mutant-0.9.5 lib/mutant/mutator/util/array.rb
mutant-0.9.4 lib/mutant/mutator/util/array.rb
mutant-0.9.3 lib/mutant/mutator/util/array.rb
mutant-0.9.2 lib/mutant/mutator/util/array.rb
mutant-0.9.1 lib/mutant/mutator/util/array.rb
mutant-0.9.0 lib/mutant/mutator/util/array.rb
mutant-0.8.24 lib/mutant/mutator/util/array.rb
mutant-0.8.23 lib/mutant/mutator/util/array.rb
mutant-0.8.22 lib/mutant/mutator/util/array.rb
mutant-0.8.21 lib/mutant/mutator/util/array.rb
mutant-0.8.20 lib/mutant/mutator/util/array.rb
mutant-0.8.19 lib/mutant/mutator/util/array.rb
mutant-0.8.18 lib/mutant/mutator/util/array.rb
mutant-0.8.17 lib/mutant/mutator/util/array.rb