Class: Canon::Comparison::ResolvedMatchOptions

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

Overview

Wrapper class for resolved match options Provides convenient methods for accessing behaviors by dimension

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options, format:, compare_profile: nil) ⇒ ResolvedMatchOptions

Returns a new instance of ResolvedMatchOptions.



25
26
27
28
29
# File 'lib/canon/comparison/match_options.rb', line 25

def initialize(options, format:, compare_profile: nil)
  @options = options
  @format = format
  @compare_profile = compare_profile
end

Instance Attribute Details

#compare_profileObject (readonly)

Returns the value of attribute compare_profile.



23
24
25
# File 'lib/canon/comparison/match_options.rb', line 23

def compare_profile
  @compare_profile
end

#formatObject (readonly)

Returns the value of attribute format.



23
24
25
# File 'lib/canon/comparison/match_options.rb', line 23

def format
  @format
end

#optionsObject (readonly)

Returns the value of attribute options.



23
24
25
# File 'lib/canon/comparison/match_options.rb', line 23

def options
  @options
end

Instance Method Details

#behavior_for(dimension) ⇒ Symbol

Get the behavior for a specific dimension

Parameters:

  • dimension (Symbol)

    The match dimension

Returns:

  • (Symbol)

    The behavior (:strict, :normalize, :ignore)



34
35
36
# File 'lib/canon/comparison/match_options.rb', line 34

def behavior_for(dimension)
  @options[dimension]
end

#preprocessingSymbol

Get the preprocessing option

Returns:

  • (Symbol)

    The preprocessing option



40
41
42
# File 'lib/canon/comparison/match_options.rb', line 40

def preprocessing
  @options[:preprocessing]
end

#semantic_diff?Boolean

Check if semantic diff is enabled

Returns:

  • (Boolean)

    true if semantic diff is enabled



46
47
48
# File 'lib/canon/comparison/match_options.rb', line 46

def semantic_diff?
  @options[:semantic_diff] == true
end

#to_hObject



50
51
52
# File 'lib/canon/comparison/match_options.rb', line 50

def to_h
  @options.dup
end