Sha256: 5043a445a043dd70367bd3cc76e8a241c9b258527a65aa51627e10617300fa65

Contents?: true

Size: 1.6 KB

Versions: 2

Compression:

Stored size: 1.6 KB

Contents

module OdeonUk
  # Internal utility classes: Do not use
  # @api private
  module Internal
    # Sanitize and standardize film titles
    class TitleSanitizer < Cinebase::TitleSanitizer
      # @!method initialize(title)
      #   Constructor
      #   @param [String] title a film title
      #   @return [CineworldUk::Internal::TitleSanitizer]

      # @!method sanitized
      #   sanitized and standardized title
      #   @return [String] sanitised title

      private

      # strings and regex to be removed
      def remove
        [
          /\s+[23][dD]/,                 # dimension
          'Autism Friendly Screening -', # autism screening
          /\ACinemagic \d{1,4} \-/,      # cinemagic
          /\(encore.+\)/i,               # encore for NT Live
          /\(live\)/i,                   # live in brackets
          'UKJFF -',                     # UK Jewish festival prefix
          /\bsing\-?a\-?long\b/i,        # singalong
          'Autism Friendly - ',          # autism friendly
          'amp;',                        # html ampersands
        ]
      end

      # regexes and their replacements
      def replace
        {
          /Bolshoi - (.*)/               => 'Bolshoi: ',
          /Globe On Screen: (.*)/        => 'Globe: ',
          /Met Opera - (.*)/             => 'Met Opera: ',
          /National Theatre Live - (.*)/ => 'National Theatre: ',
          /NT Live - (.*)/               => 'National Theatre: ',
          /ROH - (.*)/                   => 'Royal Opera House: ',
          /(.*)\- RSC Live \d{1,4}/      => 'Royal Shakespeare Company: '
        }
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
odeon_uk-4.0.1 lib/odeon_uk/internal/title_sanitizer.rb
odeon_uk-4.0.0 lib/odeon_uk/internal/title_sanitizer.rb