Class: PostcodeValidation::UseCase::ValidateAddress::FormatValidator

Inherits:
Object
  • Object
show all
Defined in:
lib/postcode_validation/use_case/validate_address/format_validator.rb

Instance Method Summary collapse

Instance Method Details

#for(country) ⇒ Object



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/postcode_validation/use_case/validate_address/format_validator.rb', line 17

def for(country)
  case country
    when 'NL'
      FormatValidators::NLPostcodeValidator.new
    when 'GB'
      FormatValidators::GBPostcodeValidator.new
    when 'BE'
      FormatValidators::BEPostcodeValidator.new
    when 'FR'
      FormatValidators::FRPostcodeValidator.new
    when 'SG'
      FormatValidators::SGPostcodeValidator.new
    when 'IN'
      FormatValidators::INPostcodeValidator.new
    when 'VN'
      FormatValidators::VNPostcodeValidator.new
    when 'TH'
      FormatValidators::THPostcodeValidator.new
    when 'MY'
      FormatValidators::MYPostcodeValidator.new
    when 'ES'
      FormatValidators::ESPostcodeValidator.new
    else
      FormatValidators::NoOpPostcodeValidator.new
  end
end