summaryrefslogtreecommitdiff
path: root/lib/gitlab/background_migration/user_mentions/lib/banzai/reference_parser.rb
blob: 3def5eb33691ea52e23b1101b3aa1683e6569ea7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# frozen_string_literal: true

module Gitlab
  module BackgroundMigration
    module UserMentions
      module Lib
        module Banzai
          # isolated Banzai::ReferenceParser
          module ReferenceParser
            # Returns the reference parser class for the given type
            #
            # Example:
            #
            #     Banzai::ReferenceParser['isolated_mentioned_group']
            #
            # This would return the `::Gitlab::BackgroundMigration::UserMentions::Lib::Banzai::ReferenceParser::IsolatedMentionedGroupParser` class.
            def self.[](name)
              const_get("::Gitlab::BackgroundMigration::UserMentions::Lib::Banzai::ReferenceParser::#{name.to_s.camelize}Parser", false)
            end
          end
        end
      end
    end
  end
end