• Yorick Peterse's avatar
    Turn reference regex constants into methods · 9aa705dd
    Yorick Peterse authored
    `Mentionable::ReferenceRegexes` used to define the following two
    constants:
    
    1. DEFAULT_PATTERN
    2. EXTERNAL_PATTERN
    
    These two constants were built using some of the class methods that
    reside in this same module. In EE we redefine one of these methods by
    using `prepend` at the start of the `ReferenceRegexes` module. This
    poses a problem: we can not move the `prepend` to the end of the file,
    because the constants later on depend on it.
    
    To resolve this problem, this commit turns these constants into class
    methods that memoize their results. This allows EE to redefine the
    appropriate methods before these two class methods are used, in turn
    allowing us to move the `prepend` to the end of the file.
    
    See https://gitlab.com/gitlab-org/gitlab-ee/merge_requests/8198 for more
    information.
    9aa705dd
reference_regexes.rb 993 Bytes