Class: Canon::Comparison::Strategies::MatchStrategyFactory

Inherits:
Object
  • Object
show all
Defined in:
lib/canon/comparison/strategies/match_strategy_factory.rb

Overview

Factory for creating match strategies

After semantic dispatch normalization, this factory is only called with semantic_diff: true. DOM matching is handled directly by the format comparators (XmlComparator, HtmlComparator, etc.).

Class Method Summary collapse

Class Method Details

.create(format:, match_options:) ⇒ Object



12
13
14
15
16
17
18
19
20
21
# File 'lib/canon/comparison/strategies/match_strategy_factory.rb', line 12

def self.create(format:, match_options:)
  unless match_options[:semantic_diff]
    raise ArgumentError,
          "MatchStrategyFactory requires semantic_diff: true; " \
          "DOM matching is handled by format comparators directly"
  end

  SemanticTreeMatchStrategy.new(format: format,
                                match_options: match_options)
end