Class: PicturehouseUk::Internal::AddressParser Private
- Inherits:
-
Object
- Object
- PicturehouseUk::Internal::AddressParser
- Defined in:
- lib/picturehouse_uk/internal/address_parser.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Parses a chunk of HTML to derive address
Constant Summary collapse
- ADDRESS_LINES_CSS =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
CSS for address lines
'.cinemaListBox'- POSTCODE_REGEX =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
regular expression for postal code
/[A-Z]{1,2}\d{1,2}[A-Z]?\s\d{1,2}[A-Z]{1,2}/
Instance Method Summary collapse
-
#address ⇒ Hash
private
:postal_code, :country.
- #initialize(html) ⇒ PicturehouseUk::Internal::AddressParser constructor private
Constructor Details
#initialize(html) ⇒ PicturehouseUk::Internal::AddressParser
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
14 15 16 |
# File 'lib/picturehouse_uk/internal/address_parser.rb', line 14 def initialize(html) @html = html end |
Instance Method Details
#address ⇒ Hash
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Uses the address naming from microformats.org/wiki/adr
:postal_code, :country
21 22 23 24 25 26 27 28 29 |
# File 'lib/picturehouse_uk/internal/address_parser.rb', line 21 def address { street_address: array[0], extended_address: array.length > 3 ? array[1] : nil, locality: array[-2], postal_code: array[-1], country: 'United Kingdom' } end |