Class: ActiveMutator::Operators::StatementDeletion

Inherits:
Base
  • Object
show all
Defined in:
lib/active_mutator/operators/statement_deletion.rb

Constant Summary

Constants inherited from Base

Base::REGISTRY

Instance Method Summary collapse

Methods inherited from Base

all, inherited

Instance Method Details

#edits(node) ⇒ Object



4
5
6
7
8
9
10
11
12
# File 'lib/active_mutator/operators/statement_deletion.rb', line 4

def edits(node)
  return [] unless node.is_a?(Prism::StatementsNode)
  return [] if node.body.size < 2

  node.body.map do |stmt|
    edit(loc_range(stmt.location), "",
         "delete `#{stmt.slice.lines.first.strip}`")
  end
end