Class: CineworldUk::Internal::NameParser Private

Inherits:
Object
  • Object
show all
Defined in:
lib/cineworld_uk/internal/name_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 string to derive a standardized movie title

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name) ⇒ NameParser

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

Parameters:

  • name (String)

    original film name



11
12
13
14
# File 'lib/cineworld_uk/internal/name_parser.rb', line 11

def initialize(name)
  @original_name = name
  @name = name
end

Instance Attribute Details

#original_nameString (readonly)

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 the original name.

Returns:

  • (String)

    the original name



8
9
10
# File 'lib/cineworld_uk/internal/name_parser.rb', line 8

def original_name
  @original_name
end

Instance Method Details

#standardizeString

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.

Process the name and return the final string

Returns:

  • (String)


18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/cineworld_uk/internal/name_parser.rb', line 18

def standardize
  strip_and_squeeze
    .ampersands_into_text
    .into_ampersand_if_second_to_last
    .remove_indian_languages
    .remove_screening_details
    .replace_non_film_prefix
    .remove_newlines
    .remove_dates
    .title_case
  to_s
end

#to_sString

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 processed name

Returns:

  • (String)


33
34
35
# File 'lib/cineworld_uk/internal/name_parser.rb', line 33

def to_s
  @name
end