Class: MetadataPresenter::PostcodeValidator

Inherits:
BaseValidator show all
Defined in:
app/validators/metadata_presenter/postcode_validator.rb

Constant Summary collapse

VALIDATABLE_COUNTRIES =
[
  'UK',
  'U.K.',
  'England',
  'United Kingdom',
  'Scotland',
  'Wales',
  'Cymru',
  'Channel Islands',
  'Isle of Man',
  'Northern Ireland'
].freeze

Instance Attribute Summary

Attributes inherited from BaseValidator

#component, #page_answers

Instance Method Summary collapse

Methods inherited from BaseValidator

#allow_blank?, #custom_error_message, #default_error_message, #error_key, #error_message_hash, #initialize, #invalid_answer?, #schema_key, #user_answer, #validation_value

Constructor Details

This class inherits a constructor from MetadataPresenter::BaseValidator

Instance Method Details

#valid?Boolean

Returns:

  • (Boolean)


18
19
20
21
22
# File 'app/validators/metadata_presenter/postcode_validator.rb', line 18

def valid?
  validate_postcode if postcode.present?

  user_answer.errors.empty?
end