Class: PostcodeValidation::Domain::PotentialAddressMatch
- Inherits:
-
Object
- Object
- PostcodeValidation::Domain::PotentialAddressMatch
- Defined in:
- lib/postcode_validation/domain/potential_address_match.rb
Instance Attribute Summary collapse
-
#description ⇒ Object
readonly
Returns the value of attribute description.
-
#text ⇒ Object
readonly
Returns the value of attribute text.
Instance Method Summary collapse
-
#initialize(text:, description:) ⇒ PotentialAddressMatch
constructor
A new instance of PotentialAddressMatch.
- #postcode_matches?(postcode) ⇒ Boolean
Constructor Details
#initialize(text:, description:) ⇒ PotentialAddressMatch
Returns a new instance of PotentialAddressMatch.
4 5 6 7 |
# File 'lib/postcode_validation/domain/potential_address_match.rb', line 4 def initialize(text:, description:) @text = text @description = description end |
Instance Attribute Details
#description ⇒ Object (readonly)
Returns the value of attribute description.
15 16 17 |
# File 'lib/postcode_validation/domain/potential_address_match.rb', line 15 def description @description end |
#text ⇒ Object (readonly)
Returns the value of attribute text.
15 16 17 |
# File 'lib/postcode_validation/domain/potential_address_match.rb', line 15 def text @text end |
Instance Method Details
#postcode_matches?(postcode) ⇒ Boolean
9 10 11 12 13 |
# File 'lib/postcode_validation/domain/potential_address_match.rb', line 9 def postcode_matches?(postcode) normalised_postcode = letters_and_numbers_only(postcode.upcase) text_includes?(normalised_postcode) || description_includes?(normalised_postcode) end |