debian-mirror-gitlab/lib/gitlab/import_export/log_util.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

20 lines
541 B
Ruby
Raw Normal View History

2022-08-27 11:52:29 +05:30
# 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