Class: Gitlab::ImportExport::LogUtil

Inherits:
Object
  • Object
show all
Defined in:
lib/gitlab/import_export/log_util.rb

Class Method Summary collapse

Class Method Details

.exportable_to_log_payload(exportable) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
# File 'lib/gitlab/import_export/log_util.rb', line 6

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