Class: Mutant::Mutator::Regexp Private

Inherits:
Mutant::Mutator show all
Defined in:
lib/mutant/mutator/regexp.rb

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Defined Under Namespace

Classes: Alternation, GroupCaptureNamed, GroupCapturePositional, Quantifier, Recurse, Registry, Replacement

Constant Summary collapse

REGISTRY =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

Registry

Registry.new

Instance Attribute Summary

Attributes inherited from Mutant::Mutator

#output

Class Method Summary collapse

Methods included from Procto

included

Class Method Details

.mutate(expression) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



43
44
45
46
47
48
# File 'lib/mutant/mutator/regexp.rb', line 43

def self.mutate(expression)
  REGISTRY
    .lookup(expression.class)
    .map { |mutator| mutator.call(input: expression, parent: nil) }
    .reduce(&:merge)
end

.regexp_body(node) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



6
7
8
9
10
11
12
13
# File 'lib/mutant/mutator/regexp.rb', line 6

def self.regexp_body(node)
  *body, _options = node.children

  body.map do |child|
    return unless child.type.equal?(:str)
    child.children
  end.join
end