Class: Evilution::Equivalent::Heuristic::AliasSwap Private
- Inherits:
-
Object
- Object
- Evilution::Equivalent::Heuristic::AliasSwap
- Defined in:
- lib/evilution/equivalent/heuristic/alias_swap.rb
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Constant Summary collapse
- ALIAS_PAIRS =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
Set[ Set[:detect, :find], Set[:length, :size], Set[:collect, :map], Set[:count, :length], Set[:count, :size] ].freeze
- MATCHING_OPERATORS =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
Set["send_mutation", "collection_replacement"].freeze
Instance Method Summary collapse
- #match?(mutation) ⇒ Boolean private
Instance Method Details
#match?(mutation) ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/evilution/equivalent/heuristic/alias_swap.rb', line 16 def match?(mutation) return false unless MATCHING_OPERATORS.include?(mutation.operator_name) diff = mutation.diff removed = extract_method(diff, "- ") added = extract_method(diff, "+ ") return false unless removed && added pair = Set[removed.to_sym, added.to_sym] ALIAS_PAIRS.include?(pair) end |