Class: AtlasEngine::AddressValidation::PredicatePipelineBuilder
- Inherits:
-
Object
- Object
- AtlasEngine::AddressValidation::PredicatePipelineBuilder
- Extended by:
- T::Sig
- Defined in:
- app/models/atlas_engine/address_validation/predicate_pipeline_builder.rb
Instance Attribute Summary collapse
-
#address ⇒ Object
readonly
Returns the value of attribute address.
-
#message_format ⇒ Object
readonly
Returns the value of attribute message_format.
-
#predicate_pipeline ⇒ Object
readonly
Returns the value of attribute predicate_pipeline.
-
#result ⇒ Object
readonly
Returns the value of attribute result.
Instance Method Summary collapse
- #full_address_validator ⇒ Object
-
#initialize(matching_strategy_name:, address:, result:, message_format:) ⇒ PredicatePipelineBuilder
constructor
A new instance of PredicatePipelineBuilder.
- #pipeline ⇒ Object
- #unsupported_fields ⇒ Object
Constructor Details
#initialize(matching_strategy_name:, address:, result:, message_format:) ⇒ PredicatePipelineBuilder
Returns a new instance of PredicatePipelineBuilder.
29 30 31 32 33 34 |
# File 'app/models/atlas_engine/address_validation/predicate_pipeline_builder.rb', line 29 def initialize(matching_strategy_name:, address:, result:, message_format:) @address = address @predicate_pipeline = T.let(PredicatePipeline.find(matching_strategy_name), PredicatePipeline) @result = result @message_format = end |
Instance Attribute Details
#address ⇒ Object (readonly)
Returns the value of attribute address.
13 14 15 |
# File 'app/models/atlas_engine/address_validation/predicate_pipeline_builder.rb', line 13 def address @address end |
#message_format ⇒ Object (readonly)
Returns the value of attribute message_format.
19 20 21 |
# File 'app/models/atlas_engine/address_validation/predicate_pipeline_builder.rb', line 19 def @message_format end |
#predicate_pipeline ⇒ Object (readonly)
Returns the value of attribute predicate_pipeline.
10 11 12 |
# File 'app/models/atlas_engine/address_validation/predicate_pipeline_builder.rb', line 10 def predicate_pipeline @predicate_pipeline end |
#result ⇒ Object (readonly)
Returns the value of attribute result.
16 17 18 |
# File 'app/models/atlas_engine/address_validation/predicate_pipeline_builder.rb', line 16 def result @result end |
Instance Method Details
#full_address_validator ⇒ Object
44 45 46 47 48 49 50 |
# File 'app/models/atlas_engine/address_validation/predicate_pipeline_builder.rb', line 44 def full_address_validator predicate_pipeline.full_address_validator&.new( address: address, result: result, message_format: , ) end |
#pipeline ⇒ Object
37 38 39 40 41 |
# File 'app/models/atlas_engine/address_validation/predicate_pipeline_builder.rb', line 37 def pipeline predicate_pipeline.pipeline.reject do |predicate_config| unsupported_fields.include?(predicate_config.field) end end |
#unsupported_fields ⇒ Object
55 56 57 58 59 60 61 62 63 64 65 |
# File 'app/models/atlas_engine/address_validation/predicate_pipeline_builder.rb', line 55 def unsupported_fields @unsupported_fields ||= T.let( begin unsupported_fields = [] unsupported_fields += address1_format == :extended ? [:address1] : [:street_name, :street_number] unsupported_fields += address2_format == :extended ? [:address2] : [:line2, :neighborhood] unsupported_fields end, T.nilable(T::Array[T.untyped]), ) end |