Class: Mutineer::Mutators::Base
- Inherits:
-
Prism::Visitor
- Object
- Prism::Visitor
- Mutineer::Mutators::Base
- Defined in:
- lib/mutineer/mutators/base.rb
Overview
Base Prism visitor for operators.
Subclasses override visit_* methods to push Mutation objects onto
@mutations. Visiting only def_node.body is the body-only enforcement:
the def signature line is never touched.
ponytail: one implementor in M1; Base earns its keep at M4 when comparison/boolean operators land and share this contract.
Direct Known Subclasses
Arithmetic, BooleanConnector, BooleanLiteral, CollectionMethod, Comparison, ConditionNegation, LiteralMutation, RegexLiteral, ReturnNil, StatementRemoval, StringLiteral
Instance Method Summary collapse
-
#mutations_for(subject, source) ⇒ Array<Mutineer::Mutation>
Walks the subject body and collects mutations.
Instance Method Details
#mutations_for(subject, source) ⇒ Array<Mutineer::Mutation>
Walks the subject body and collects mutations.
23 24 25 26 27 28 |
# File 'lib/mutineer/mutators/base.rb', line 23 def mutations_for(subject, source) @source = source @mutations = [] subject.def_node.body&.accept(self) @mutations end |