Class: AtlasEngine::CountryProfileValidationSubset
Instance Attribute Summary
#attributes
Instance Method Summary
collapse
#initialize
Instance Method Details
#address_parser ⇒ Object
44
45
46
|
# File 'app/models/atlas_engine/country_profile_validation_subset.rb', line 44
def address_parser
attributes.dig("address_parser").constantize
end
|
#city_alias ⇒ Object
83
84
85
|
# File 'app/models/atlas_engine/country_profile_validation_subset.rb', line 83
def city_alias
attributes.dig("city_alias").nil? ? true : attributes.dig("city_alias")
end
|
#comparison_policy(field) ⇒ Object
#component_comparison(component) ⇒ Object
73
74
75
|
# File 'app/models/atlas_engine/country_profile_validation_subset.rb', line 73
def component_comparison(component)
attributes.dig("address_comparison", component.to_s).constantize
end
|
#default_matching_strategy ⇒ Object
12
13
14
|
# File 'app/models/atlas_engine/country_profile_validation_subset.rb', line 12
def default_matching_strategy
attributes.dig("default_matching_strategy")
end
|
#enabled ⇒ Object
7
8
9
|
# File 'app/models/atlas_engine/country_profile_validation_subset.rb', line 7
def enabled
!!attributes.dig("enabled")
end
|
#index_locales ⇒ Object
17
18
19
|
# File 'app/models/atlas_engine/country_profile_validation_subset.rb', line 17
def index_locales
attributes.dig("index_locales") || []
end
|
#multi_locale? ⇒ Boolean
22
23
24
|
# File 'app/models/atlas_engine/country_profile_validation_subset.rb', line 22
def multi_locale?
index_locales.size > 1
end
|
#normalized_components ⇒ Object
49
50
51
|
# File 'app/models/atlas_engine/country_profile_validation_subset.rb', line 49
def normalized_components
attributes.dig("normalized_components") || []
end
|
#partial_postal_code_range(length) ⇒ Object
36
37
38
39
40
41
|
# File 'app/models/atlas_engine/country_profile_validation_subset.rb', line 36
def partial_postal_code_range(length)
range = attributes.dig("partial_postal_code_range_for_length", length)
return unless range
Range.new(*range.split("..").map(&:to_i))
end
|
#unmatched_components_suggestion_threshold ⇒ Object
68
69
70
|
# File 'app/models/atlas_engine/country_profile_validation_subset.rb', line 68
def unmatched_components_suggestion_threshold
attributes.dig("unmatched_components_suggestion_threshold") || 2
end
|
#validation_exclusions(component:) ⇒ Object
30
31
32
33
|
# File 'app/models/atlas_engine/country_profile_validation_subset.rb', line 30
def validation_exclusions(component:)
validation_exclusions = attributes.dig("exclusions", component.to_s) || []
validation_exclusions.map(&:constantize)
end
|
#zip_prefix_length ⇒ Object
78
79
80
|
# File 'app/models/atlas_engine/country_profile_validation_subset.rb', line 78
def zip_prefix_length
attributes.dig("zip_prefix_length") || 0
end
|