Class: PicturehouseUk::Internal::FilmWithScreeningsParser Private

Inherits:
Object
  • Object
show all
Defined in:
lib/picturehouse_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.

film name css

'.movielink'
SCREENING_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.

showings css

'a[epoch]'

Instance Method Summary collapse

Constructor Details

#initialize(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.

Parameters:

  • film_html (Nokogiri::HTML)

    a chunk of html



12
13
14
# File 'lib/picturehouse_uk/internal/film_with_screenings_parser.rb', line 12

def initialize(html)
  @html = html
end

Instance Method Details

#film_nameString

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

Returns:

  • (String)


18
19
20
# File 'lib/picturehouse_uk/internal/film_with_screenings_parser.rb', line 18

def film_name
  TitleSanitizer.new(raw_film_name).sanitized
end

#to_aArray<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.

Showings hashes

Returns:

  • (Array<Hash>)


24
25
26
27
28
29
30
31
32
# File 'lib/picturehouse_uk/internal/film_with_screenings_parser.rb', line 24

def to_a
  return [] unless screenings?
  screening_nodes.map do |node|
    {
      film_name: film_name,
      dimension: dimension
    }.merge(ScreeningParser.new(node).to_hash)
  end
end