Welcome to mirror list, hosted at ThFree Co, Russian Federation.

log_util.rb « import_export « gitlab « lib - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: d3a3dce47ba0d8825380dbc8bb9cfe7d254836b3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# frozen_string_literal: true

module Gitlab
  module ImportExport
    class LogUtil
      def self.exportable_to_log_payload(exportable)
        attribute_base_name = exportable.class.name.underscore

        return {} unless %w[project group].include?(attribute_base_name)

        {}.tap do |log|
          log[:"#{attribute_base_name}_id"] = exportable.id
          log[:"#{attribute_base_name}_name"] = exportable.name
          log[:"#{attribute_base_name}_path"] = exportable.full_path
        end.compact
      end
    end
  end
end