class PicturehouseUk::Internal::FilmWithShowtimes

@api private collection of timings for a specific film

Constants

NAME

film name css

VARIANTS

variants css

Public Class Methods

new(node, date) click to toggle source
# File lib/picturehouse_uk/internal/parser/screenings.rb, line 55
def initialize(node, date)
  @node = node
  @date = date
end

Public Instance Methods

name() click to toggle source

The film name @return [String]

# File lib/picturehouse_uk/internal/parser/screenings.rb, line 62
def name
  TitleSanitizer.new(raw_name).sanitized
end
to_a() click to toggle source

Showings hashes @return [Array<Hash>]

# 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

Private Instance Methods

dimension() click to toggle source
# File lib/picturehouse_uk/internal/parser/screenings.rb, line 81
def dimension
  raw_name =~ /3d/i ? '3d' : '2d'
end
raw_name() click to toggle source
# File lib/picturehouse_uk/internal/parser/screenings.rb, line 85
def raw_name
  @raw_name ||= @node.css(NAME).children.first.to_s
end