@@ -54,13 +54,13 @@ def index(header)
54
54
#
55
55
class << self
56
56
57
- def klass_to_operators ( klass )
57
+ def klass_to_operators ( klass , config : DataShift :: Configuration . call )
58
58
59
- headers = Headers . new ( klass )
59
+ headers = Headers . new ( klass , config : config )
60
60
61
61
headers . class_source_to_headers
62
62
63
- DataShift ::Transformation ::Remove . new . unwanted_headers ( headers )
63
+ DataShift ::Transformation ::RemoveUnwantedHeaders . call ( headers , config : config )
64
64
65
65
headers
66
66
end
@@ -74,20 +74,18 @@ def klass_to_operators(klass)
74
74
# These can be used to infer an operator to call from an inbound header
75
75
# or provide mapping to an internal method from an external header
76
76
#
77
- def class_source_to_operators
77
+ def class_source_to_operators ( config : DataShift :: Configuration . call )
78
78
79
79
raise SourceIsNotAClass , 'Cannot parse source for headers - source must be a Class' unless source . is_a? ( Class )
80
80
81
81
# TODO: This collection can now be sorted
82
82
collection = ModelMethods ::Manager . catalog_class ( source )
83
83
84
- configuration = DataShift ::Configuration . call
85
-
86
84
if collection
87
85
collection . each do |mm |
88
86
next if ( DataShift ::Transformation ::Remove . new . association? ( mm ) )
89
87
90
- next unless configuration . op_type_in_scope? ( mm )
88
+ next unless config . op_type_in_scope? ( mm )
91
89
if ( mm . association_type? )
92
90
association_to_headers ( mm )
93
91
else
@@ -100,11 +98,9 @@ def class_source_to_operators
100
98
101
99
alias class_source_to_headers class_source_to_operators
102
100
103
- def association_to_headers ( model_method )
104
-
105
- configuration = DataShift ::Configuration . call
101
+ def association_to_headers ( model_method , config : DataShift ::Configuration . call )
106
102
107
- if ( configuration . expand_associations )
103
+ if ( config . expand_associations )
108
104
model_method . association_columns . each do |c |
109
105
add "#{ model_method . operator } ::#{ c . name } "
110
106
end
0 commit comments