Class: Mutineer::Mutators::BooleanConnector

Inherits:
Base
  • Object
show all
Defined in:
lib/mutineer/mutators/boolean_connector.rb

Overview

Boolean connector operator: && <-> ||, and <-> or. Replacement is derived from the actual source token (operator_loc.slice) so symbolic and keyword forms each map to their own form — never crossing && to or, which would change precedence and surprise the reader (KTD-2).

Clean-room: from the spec's operator table, not the mutant gem.

Constant Summary collapse

REPLACEMENTS =
{ "&&" => "||", "||" => "&&", "and" => "or", "or" => "and" }.freeze

Instance Method Summary collapse

Methods inherited from Base

#mutations_for

Instance Method Details

#visit_and_node(node) ⇒ Object



16
17
18
19
# File 'lib/mutineer/mutators/boolean_connector.rb', line 16

def visit_and_node(node)
  emit(node)
  super
end

#visit_or_node(node) ⇒ Object



21
22
23
24
# File 'lib/mutineer/mutators/boolean_connector.rb', line 21

def visit_or_node(node)
  emit(node)
  super
end