Sha256: d564ed82c781c845ad1403665d3578140d6df1e2eb8f1d4defc9bcdf48740c59

Contents?: true

Size: 878 Bytes

Versions: 7

Compression:

Stored size: 878 Bytes

Contents

# frozen_string_literal: true

module Mutant
  class Mutator
    class Node
      class Literal < self
        # Mutator for array literals
        class Array < self

          handle(:array)

        private

          # Emit mutations
          #
          # @return [undefined]
          def dispatch
            emit_singletons
            emit_type
            mutate_body
            return unless children.one?
            emit(children.first)
          end

          # Mutate body
          #
          # @return [undefined]
          def mutate_body
            children.each_index do |index|
              dup_children = children.dup
              dup_children.delete_at(index)
              emit_type(*dup_children)
              mutate_child(index)
            end
          end

        end # Array
      end # Literal
    end # Node
  end # Mutator
end # Mutant

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
mutant-0.8.23 lib/mutant/mutator/node/literal/array.rb
mutant-0.8.22 lib/mutant/mutator/node/literal/array.rb
mutant-0.8.21 lib/mutant/mutator/node/literal/array.rb
mutant-0.8.20 lib/mutant/mutator/node/literal/array.rb
mutant-0.8.19 lib/mutant/mutator/node/literal/array.rb
mutant-0.8.18 lib/mutant/mutator/node/literal/array.rb
mutant-0.8.17 lib/mutant/mutator/node/literal/array.rb