Class: PostcodeValidation::Domain::PotentialAddressMatch
- Inherits:
-
Object
- Object
- PostcodeValidation::Domain::PotentialAddressMatch
- Defined in:
- lib/postcode_validation/domain/potential_address_match.rb
Instance Attribute Summary collapse
-
#text ⇒ Object
readonly
Returns the value of attribute text.
Instance Method Summary collapse
-
#initialize(text:) ⇒ PotentialAddressMatch
constructor
A new instance of PotentialAddressMatch.
- #postcode_matches?(postcode) ⇒ Boolean
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
#text ⇒ Object (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
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 |