Class: Henitai::Operators::LogicalOperator
- Inherits:
-
Henitai::Operator
- Object
- Henitai::Operator
- Henitai::Operators::LogicalOperator
- Defined in:
- lib/henitai/operators/logical_operator.rb
Overview
Replaces short-circuit logical operators and collapses them to operands.
Constant Summary collapse
- NODE_TYPES =
%i[and or].freeze
Constants inherited from Henitai::Operator
Henitai::Operator::FULL_SET, Henitai::Operator::LIGHT_SET
Class Method Summary collapse
Instance Method Summary collapse
Methods inherited from Henitai::Operator
Class Method Details
.node_types ⇒ Object
11 12 13 |
# File 'lib/henitai/operators/logical_operator.rb', line 11 def self.node_types NODE_TYPES end |
Instance Method Details
#mutate(node, subject:) ⇒ Object
15 16 17 18 19 20 21 22 23 24 |
# File 'lib/henitai/operators/logical_operator.rb', line 15 def mutate(node, subject:) case node.type when :and mutate_and(node, subject:) when :or mutate_or(node, subject:) else [] end end |