Class: Mutineer::Mutators::BooleanConnector

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

Overview

Boolean connector mutator.

Replaces symbolic and keyword connectors with their opposite form.

Constant Summary collapse

REPLACEMENTS =

Token replacements for boolean connectors.

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

Instance Method Summary collapse

Methods inherited from Base

#mutations_for

Instance Method Details

#visit_and_node(node) ⇒ void

This method returns an undefined value.

Visits and nodes.

Parameters:

  • node (Prism::AndNode)

    node to inspect.



18
19
20
21
# File 'lib/mutineer/mutators/boolean_connector.rb', line 18

def visit_and_node(node)
  emit(node)
  super
end

#visit_or_node(node) ⇒ void

This method returns an undefined value.

Visits or nodes.

Parameters:

  • node (Prism::OrNode)

    node to inspect.



27
28
29
30
# File 'lib/mutineer/mutators/boolean_connector.rb', line 27

def visit_or_node(node)
  emit(node)
  super
end