Class: PicturehouseUk::Cinema
- Inherits:
-
Object
- Object
- PicturehouseUk::Cinema
- Defined in:
- lib/picturehouse_uk/cinema.rb
Overview
The object representing a cinema on the Picturehouse UK website
Constant Summary collapse
- ADDRESS_CSS =
address css
'.box6 .txt6'- CINEMA_LINKS_CSS =
cinema link css
'#cinemalisthome .cinemas a'
Instance Attribute Summary collapse
-
#brand ⇒ String
readonly
The brand of the cinema.
-
#id ⇒ String
readonly
The id of the cinema on the Picturehouse website.
-
#name ⇒ String
readonly
The name of the cinema.
-
#slug ⇒ String
readonly
The slug of the cinema.
-
#url ⇒ String
readonly
The url of the cinema on the Picturehouse website.
Class Method Summary collapse
-
.all ⇒ Array<PicturehouseUk::Cinema>
Return basic cinema information for all cinemas.
-
.find(id) ⇒ PicturehouseUk::Cinema?
Find a single cinema.
Instance Method Summary collapse
-
#adr ⇒ Hash
(also: #address)
Address of the cinema.
-
#extended_address ⇒ String?
The second address line of of the cinema.
-
#films ⇒ Array<PicturehouseUk::Film>
Films with showings scheduled at this cinema.
-
#full_name ⇒ String
The name of the cinema (might include brand).
- #initialize(options) ⇒ PicturehouseUk::Cinema constructor
-
#locality ⇒ String
The locality (town) of the cinema.
-
#postal_code ⇒ String
Post code of the cinema.
-
#screenings ⇒ Array<PicturehouseUk::Screening>
All planned screenings.
-
#street_address ⇒ Object
The street adress of the cinema.
Constructor Details
#initialize(options) ⇒ PicturehouseUk::Cinema
22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/picturehouse_uk/cinema.rb', line 22 def initialize() @brand = 'Picturehouse' @id = [:id] @name = [:name] @slug = @name.downcase.gsub(/[^0-9a-z ]/, '').gsub(/\s+/, '-') @url = if [:url][0] == '/' "http://www.picturehouses.co.uk#{[:url]}" else [:url] end end |
Instance Attribute Details
#brand ⇒ String (readonly)
Returns the brand of the cinema.
10 11 12 |
# File 'lib/picturehouse_uk/cinema.rb', line 10 def brand @brand end |
#id ⇒ String (readonly)
Returns the id of the cinema on the Picturehouse website.
12 13 14 |
# File 'lib/picturehouse_uk/cinema.rb', line 12 def id @id end |
#name ⇒ String (readonly)
Returns the name of the cinema.
14 15 16 |
# File 'lib/picturehouse_uk/cinema.rb', line 14 def name @name end |
#slug ⇒ String (readonly)
Returns the slug of the cinema.
16 17 18 |
# File 'lib/picturehouse_uk/cinema.rb', line 16 def slug @slug end |
#url ⇒ String (readonly)
Returns the url of the cinema on the Picturehouse website.
18 19 20 |
# File 'lib/picturehouse_uk/cinema.rb', line 18 def url @url end |
Class Method Details
.all ⇒ Array<PicturehouseUk::Cinema>
Return basic cinema information for all cinemas
39 40 41 |
# File 'lib/picturehouse_uk/cinema.rb', line 39 def self.all cinema_links.map { |link| new_from_link(link) } end |
.find(id) ⇒ PicturehouseUk::Cinema?
Find a single cinema
49 50 51 |
# File 'lib/picturehouse_uk/cinema.rb', line 49 def self.find(id) all.find { |cinema| cinema.id == id } end |
Instance Method Details
#adr ⇒ Hash Also known as: address
Uses method naming as at microformats.org/wiki/adr
Address of the cinema
66 67 68 |
# File 'lib/picturehouse_uk/cinema.rb', line 66 def adr PicturehouseUk::Internal::AddressParser.new(address_node.to_s).address end |
#extended_address ⇒ String?
Uses method naming as at microformats.org/wiki/adr
The second address line of of the cinema
78 79 80 |
# File 'lib/picturehouse_uk/cinema.rb', line 78 def extended_address address[:extended_address] end |
#films ⇒ Array<PicturehouseUk::Film>
Films with showings scheduled at this cinema
88 89 90 |
# File 'lib/picturehouse_uk/cinema.rb', line 88 def films PicturehouseUk::Film.at(@id) end |
#full_name ⇒ String
The name of the cinema (might include brand)
98 99 100 |
# File 'lib/picturehouse_uk/cinema.rb', line 98 def full_name name end |
#locality ⇒ String
Uses the standard method naming as at microformats.org/wiki/adr
The locality (town) of the cinema
109 110 111 |
# File 'lib/picturehouse_uk/cinema.rb', line 109 def locality address[:locality] end |
#postal_code ⇒ String
Uses the standard method naming as at microformats.org/wiki/adr
Post code of the cinema
120 121 122 |
# File 'lib/picturehouse_uk/cinema.rb', line 120 def postal_code address[:postal_code] end |
#screenings ⇒ Array<PicturehouseUk::Screening>
All planned screenings
130 131 132 |
# File 'lib/picturehouse_uk/cinema.rb', line 130 def screenings PicturehouseUk::Screening.at(@id) end |
#street_address ⇒ Object
Uses the standard method naming as at microformats.org/wiki/adr
The street adress of the cinema
141 142 143 |
# File 'lib/picturehouse_uk/cinema.rb', line 141 def street_address address[:street_address] end |