Sha256: 2c04532379039f5cf24bf90915b2e778e31d269750b9a4e7d5ddc255136f9287

Contents?: true

Size: 909 Bytes

Versions: 5

Compression:

Stored size: 909 Bytes

Contents

# encoding: UTF-8

module Mutant
  class Mutator
    class Node
      # Mutator for resbody nodes
      class Resbody < self

        handle(:resbody)

        children :captures, :assignment, :body

      private

        # Emit mutations
        #
        # @return [undefined]
        #
        # @api private
        #
        def dispatch
          emit_assignment(nil)
          emit_body_mutations if body
          mutate_captures
        end

        # Mutate captures
        #
        # @return [undefined]
        #
        # @api private
        #
        def mutate_captures
          return unless captures
          Util::Array.each(captures.children, self) do |matchers|
            next if matchers.empty? || matchers.any? { |node| node.type == :nil }
            emit_captures(s(:array, *matchers))
          end
        end

      end # Resbody
    end # Node
  end # Mutator
end # Mutant

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
mutant-0.5.18 lib/mutant/mutator/node/resbody.rb
mutant-0.5.17 lib/mutant/mutator/node/resbody.rb
mutant-0.5.16 lib/mutant/mutator/node/resbody.rb
mutant-0.5.15 lib/mutant/mutator/node/resbody.rb
mutant-0.5.14 lib/mutant/mutator/node/resbody.rb