Class: PicturehouseUk::Internal::FilmWithShowtimes Private

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

collection of timings for a specific film

Constant Summary collapse

NAME =

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

'.top-mg-sm a'.freeze
VARIANTS =

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.

variants css

'.film-times .col-xs-10'.freeze

Instance Method Summary collapse

Constructor Details

#initialize(node, date) ⇒ FilmWithShowtimes

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 FilmWithShowtimes.



55
56
57
58
# File 'lib/picturehouse_uk/internal/parser/screenings.rb', line 55

def initialize(node, date)
  @node = node
  @date = date
end

Instance Method Details

#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)


62
63
64
# File 'lib/picturehouse_uk/internal/parser/screenings.rb', line 62

def name
  TitleSanitizer.new(raw_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>)


68
69
70
71
72
73
74
75
76
77
# File 'lib/picturehouse_uk/internal/parser/screenings.rb', line 68

def to_a
  Array(@node.css(VARIANTS)).flat_map do |variant|
    Variant.new(variant, @date).to_a.map do |hash|
      {
        film_name: name,
        dimension: dimension
      }.merge(hash)
    end
  end
end