Class: CineworldUk::Internal::FilmWithScreeningsParser Private
- Inherits:
-
Object
- Object
- CineworldUk::Internal::FilmWithScreeningsParser
- Defined in:
- lib/cineworld_uk/internal/film_with_screenings_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 movie showing data
Constant Summary collapse
- FILM_NAME_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 selector for film name
'h3.h1 a[href*=whatson]'- PERFORMANCES_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 selector for performances
'.schedule .performances > li'
Instance Method Summary collapse
-
#cinema_id ⇒ String
private
The cinema id.
-
#film_name ⇒ String
private
The film name.
-
#initialize(film_html) ⇒ FilmWithScreeningsParser
constructor
private
A new instance of FilmWithScreeningsParser.
-
#to_a ⇒ Array<Hash>
private
attributes of all the screenings.
Constructor Details
#initialize(film_html) ⇒ FilmWithScreeningsParser
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.
Returns a new instance of FilmWithScreeningsParser.
13 14 15 |
# File 'lib/cineworld_uk/internal/film_with_screenings_parser.rb', line 13 def initialize(film_html) @film_html = film_html.to_s end |
Instance Method Details
#cinema_id ⇒ String
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.
The cinema id
19 20 21 |
# File 'lib/cineworld_uk/internal/film_with_screenings_parser.rb', line 19 def cinema_id name_doc.to_s.match(/cinema=(\d+)/)[1].to_i end |
#film_name ⇒ String
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.
The film name
25 26 27 |
# File 'lib/cineworld_uk/internal/film_with_screenings_parser.rb', line 25 def film_name name_doc.children[0].to_s end |
#to_a ⇒ Array<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.
attributes of all the screenings
31 32 33 34 35 36 |
# File 'lib/cineworld_uk/internal/film_with_screenings_parser.rb', line 31 def to_a performances_doc.map do |node| next unless screening_parser_hash(node) screening_parser_hash(node).merge(film_hash) end.compact end |