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.



20
21
22
23
24
# File 'lib/canon/comparison/match_options.rb', line 20

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.



18
19
20
# File 'lib/canon/comparison/match_options.rb', line 18

def compare_profile
  @compare_profile
end

#formatObject (readonly)

Returns the value of attribute format.



18
19
20
# File 'lib/canon/comparison/match_options.rb', line 18

def format
  @format
end

#optionsObject (readonly)

Returns the value of attribute options.



18
19
20
# File 'lib/canon/comparison/match_options.rb', line 18

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)



29
30
31
# File 'lib/canon/comparison/match_options.rb', line 29

def behavior_for(dimension)
  @options[dimension]
end

#preprocessingSymbol

Get the preprocessing option

Returns:

  • (Symbol)

    The preprocessing option



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

def preprocessing
  @options[:preprocessing]
end

#to_hObject



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

def to_h
  @options.dup
end