Sha256: 93361d11232163fc31aa04da8130c442ccf082fc20921552b343334cb5272ebd

Contents?: true

Size: 982 Bytes

Versions: 2

Compression:

Stored size: 982 Bytes

Contents

# encoding: utf-8

module Mutant
  class Mutator
    class Node

      # Mutator for begin nodes
      class Begin < self

        handle(:begin)

      private

        # Emit mutants
        #
        # @return [undefined]
        #
        # @api private
        #
        def dispatch
          Util::Array.each(children, self) do |children|
            emit_child_subset(children)
          end
          children.each_with_index do |child, index|
            mutate_child(index)
            emit(child)
          end
        end

        # Emit child subset
        #
        # @param [Array<Parser::AST::Node>] nodes
        #
        # @return [undefined]
        #
        # @api private
        #
        def emit_child_subset(children)
          case children.length
          when 0
          when 1
            emit(children.first)
          else
            emit_type(*children)
          end
        end

      end # Block
    end # Node
  end # Mutator
end # Mutant

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
mutant-0.5.19 lib/mutant/mutator/node/begin.rb
mutant-0.5.18 lib/mutant/mutator/node/begin.rb