Class: ActiveMutator::Operators::ConditionalBoundary
- Defined in:
- lib/active_mutator/operators/conditional_boundary.rb
Constant Summary collapse
- MAP =
{ :> => ">=", :>= => ">", :< => "<=", :<= => "<" }.freeze
Constants inherited from Base
Instance Method Summary collapse
Methods inherited from Base
Instance Method Details
#edits(node) ⇒ Object
6 7 8 9 10 11 12 13 |
# File 'lib/active_mutator/operators/conditional_boundary.rb', line 6 def edits(node) return [] unless node.is_a?(Prism::CallNode) && MAP.key?(node.name) return [] unless node.receiver && node.arguments&.arguments&.size == 1 replacement = MAP.fetch(node.name) [edit(loc_range(node.), replacement, "replace `#{node.name}` with `#{replacement}`")] end |