Sha256: 327b457518378a5eee5d7c701d55e2a318e170d84cbcf315744f13f01126230f
Contents?: true
Size: 1.41 KB
Versions: 2
Compression:
Stored size: 1.41 KB
Contents
module CineworldUk # @api private module Internal module Parser module Api # Parses a hash to produce film information class Film # the cineworld id for the film attr_reader :id # @param [Hash] data parsed from performances JSON # @return [ CineworldUk::Internal::Parser::Api::Film] def initialize(data) @data = data @id = @data['edi'] end # Do you need your 3D glasses? # @return [String] either '2d' or '3d' def dimension @data['format'] =~ /3D/i ? '3d' : '2d' end # Sanitized film name # @return [String] def name TitleSanitizer.new(@data['originalTitle'] || '').sanitized end # List of strings representing different kinds of performance, such # as autism, kids, imax, members or q&a # @return [Array<String>] or an empty array def variant [ @data['title'] =~ /Autism Friendly/i ? 'autism_friendly' : nil, @data.fetch('format' || '') =~ /IMAX/i ? 'imax' : nil, @data['title'] =~ /Movies for Juniors/i ? 'kids' : nil, @data['title'] =~ /Unlimited Screening/i ? 'members' : nil, @data['title'] =~ /Q (and|&) A/i ? 'q&a' : nil ].compact end end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
cineworld_uk-3.0.3 | lib/cineworld_uk/internal/parser/api/film.rb |
cineworld_uk-3.0.2 | lib/cineworld_uk/internal/parser/api/film.rb |