from pathlib import Path


def _get_class_name(homebrew_recipe_filename: str) -> str:
    """
    The Ruby class name depends on the file name.

    The first character is capitalized.
    Some characters are removed, and if a character is removed, the next
    character is capitalized.

    Returns:
        The Ruby class name to use, given a file name.
    """
    stem = Path(homebrew_recipe_filename).stem
    disallowed_characters = {'-', '.', '+'}
    class_name = ''
    for index, character in enumerate(list(stem)):
        if character in disallowed_characters:  # pragma: no cover
            pass
        else:
            if index == 0 or list(stem)[index - 1] in disallowed_characters:
                class_name += character.upper()
            else:
                class_name += character

    return class_name