Class: Gitlab::ImportExport::AttributesFinder

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(config:) ⇒ AttributesFinder

Returns a new instance of AttributesFinder.


8
9
10
11
12
13
14
# File 'lib/gitlab/import_export/attributes_finder.rb', line 8

def initialize(config:)
  @tree = config[:tree] || {}
  @included_attributes = config[:included_attributes] || {}
  @excluded_attributes = config[:excluded_attributes] || {}
  @methods = config[:methods] || {}
  @preloads = config[:preloads] || {}
end

Instance Attribute Details

#excluded_attributesObject (readonly)

Returns the value of attribute excluded_attributes


6
7
8
# File 'lib/gitlab/import_export/attributes_finder.rb', line 6

def excluded_attributes
  @excluded_attributes
end

#included_attributesObject (readonly)

Returns the value of attribute included_attributes


6
7
8
# File 'lib/gitlab/import_export/attributes_finder.rb', line 6

def included_attributes
  @included_attributes
end

#methodsObject (readonly)

Returns the value of attribute methods


6
7
8
# File 'lib/gitlab/import_export/attributes_finder.rb', line 6

def methods
  @methods
end

#preloadsObject (readonly)

Returns the value of attribute preloads


6
7
8
# File 'lib/gitlab/import_export/attributes_finder.rb', line 6

def preloads
  @preloads
end

#treeObject (readonly)

Returns the value of attribute tree


6
7
8
# File 'lib/gitlab/import_export/attributes_finder.rb', line 6

def tree
  @tree
end

Instance Method Details

#find_excluded_keys(klass_name) ⇒ Object


24
25
26
# File 'lib/gitlab/import_export/attributes_finder.rb', line 24

def find_excluded_keys(klass_name)
  @excluded_attributes[klass_name.to_sym]&.map(&:to_s) || []
end

#find_relations_tree(model_key) ⇒ Object


20
21
22
# File 'lib/gitlab/import_export/attributes_finder.rb', line 20

def find_relations_tree(model_key)
  @tree[model_key]
end

#find_root(model_key) ⇒ Object


16
17
18
# File 'lib/gitlab/import_export/attributes_finder.rb', line 16

def find_root(model_key)
  find(model_key, @tree[model_key])
end