Module: Applitools::MatchLevelSetter

Included in:
EyesBase, FluentInterface, ImageMatchSettings
Defined in:
lib/applitools/core/match_level_setter.rb

Instance Method Summary collapse

Instance Method Details

#match_level_with_exact(value, exact_options = {}) ⇒ Object

Raises:

  • (Applitools::EyesError)


4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/applitools/core/match_level_setter.rb', line 4

def match_level_with_exact(value, exact_options = {})
  raise Applitools::EyesError unless
      Applitools::MATCH_LEVEL.keys.include?(value) | Applitools::MatchLevel.enum_values.include?(value)

  if value != :exact && value != Applitools::MatchLevel::EXACT && (exact_options && !exact_options.empty?)
    raise Applitools::EyesError.new(
      'Exact options are accepted only for EXACT match level'
    )
  end
  match_level_value = if Applitools::MatchLevel.enum_values.include?(value)
                        value
                      else
                        Applitools::MATCH_LEVEL[value]
                      end
  [match_level_value, value == Applitools::MatchLevel::EXACT ? convert_exact_options(exact_options) : nil]
end