Class: PicturehouseUk::Internal::Parser::Address Private

Inherits:
Object
  • Object
show all
Defined in:
lib/picturehouse_uk/internal/parser/address.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

Instance Method Summary collapse

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.

Parameters:

  • node (String)

    the HTML to parse into an address



9
10
11
# File 'lib/picturehouse_uk/internal/parser/address.rb', line 9

def initialize(html)
  @html = html.to_s
end

Instance Method Details

#addressHash

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.

Note:

Uses the address naming from microformats.org/wiki/adr

:postal_code, :country

Returns:

  • (Hash)

    contains :street_address, :extended_address, :locality,



16
17
18
19
20
21
22
23
24
25
# File 'lib/picturehouse_uk/internal/parser/address.rb', line 16

def address
  {
    street_address:   array[1],
    extended_address: extended_address,
    locality:         town,
    region:           region,
    postal_code:      postal_code,
    country_name:     'United Kingdom'.freeze
  }
end