Class: PostcodeValidation::Domain::PotentialAddressMatch

Inherits:
Object
  • Object
show all
Defined in:
lib/postcode_validation/domain/potential_address_match.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(text:) ⇒ PotentialAddressMatch

Returns a new instance of PotentialAddressMatch.



4
5
6
# File 'lib/postcode_validation/domain/potential_address_match.rb', line 4

def initialize(text:)
  @text = text
end

Instance Attribute Details

#textObject (readonly)

Returns the value of attribute text.



12
13
14
# File 'lib/postcode_validation/domain/potential_address_match.rb', line 12

def text
  @text
end

Instance Method Details

#postcode_matches?(postcode) ⇒ Boolean

Returns:

  • (Boolean)


8
9
10
# File 'lib/postcode_validation/domain/potential_address_match.rb', line 8

def postcode_matches?(postcode)
  letters_and_numbers_only(text).include?(letters_and_numbers_only(postcode.upcase))
end