Sha256: f191c62bfad7fbd3a614fbe3c691a4988df9d592e4fb951d427a49f266e8aef3

Contents?: true

Size: 964 Bytes

Versions: 2

Compression:

Stored size: 964 Bytes

Contents

# encoding: utf-8

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

          handle(:array)

        private

          # Emit mutations
          #
          # @return [undefined]
          #
          # @api private
          #
          def dispatch
            emit_nil
            emit_self
            mutate_body
            if children.one?
              emit(children.first)
            end
          end

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

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

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
mutant-0.5.17 lib/mutant/mutator/node/literal/array.rb
mutant-0.5.16 lib/mutant/mutator/node/literal/array.rb