blob: ebfbaf6f6baa47e0ec00311ea5988536ade7e766 (
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
# frozen_string_literal: true
module BulkImports
module Pipeline
module Attributes
extend ActiveSupport::Concern
include Gitlab::ClassAttributes
class_methods do
def extractor(klass, options = nil)
add_attribute(:extractors, klass, options)
end
def transformer(klass, options = nil)
add_attribute(:transformers, klass, options)
end
def loader(klass, options = nil)
add_attribute(:loaders, klass, options)
end
def add_attribute(sym, klass, options)
class_attributes[sym] ||= []
class_attributes[sym] << { klass: klass, options: options }
end
def extractors
class_attributes[:extractors]
end
def transformers
class_attributes[:transformers]
end
def loaders
class_attributes[:loaders]
end
end
end
end
end
|