File tree 4 files changed +20
-14
lines changed
4 files changed +20
-14
lines changed Original file line number Diff line number Diff line change @@ -43,6 +43,11 @@ def relations
43
43
configuration . relations
44
44
end
45
45
46
+ # @api public
47
+ def command_compiler
48
+ configuration . command_compiler
49
+ end
50
+
46
51
# @api public
47
52
def notifications
48
53
configuration . notifications
Original file line number Diff line number Diff line change @@ -25,7 +25,7 @@ def adapter
25
25
# @return [ROM::Relation]
26
26
#
27
27
# @api public
28
- def build ( command_compiler : )
28
+ def build
29
29
unless adapter
30
30
raise MissingAdapterIdentifierError ,
31
31
"Relation class +#{ constant } + is missing the adapter identifier"
@@ -60,7 +60,7 @@ def build(command_compiler:)
60
60
relation = constant . new ( dataset , **options )
61
61
62
62
# TODO: this will be removed once command registry is lazy-by-default
63
- finalize_commands ( command_compiler , relation )
63
+ finalize_commands ( relation )
64
64
65
65
relation
66
66
end
@@ -86,7 +86,7 @@ def finalize_mappers
86
86
end
87
87
88
88
# @api private
89
- def finalize_commands ( command_compiler , relation )
89
+ def finalize_commands ( relation )
90
90
commands = components . commands
91
91
. select { |command | command . relation_name == constant . relation_name . relation }
92
92
. map { |command | command . build ( relation : relation ) }
Original file line number Diff line number Diff line change @@ -76,6 +76,17 @@ def finalize
76
76
self
77
77
end
78
78
79
+ # @api private
80
+ def command_compiler
81
+ @command_compiler ||= CommandCompiler . new (
82
+ gateways ,
83
+ relations ,
84
+ Registry . new ,
85
+ notifications ,
86
+ inflector : inflector
87
+ )
88
+ end
89
+
79
90
# Apply a plugin to the configuration
80
91
#
81
92
# @param [Mixed] plugin The plugin identifier, usually a Symbol
Original file line number Diff line number Diff line change @@ -56,18 +56,8 @@ def relations
56
56
#
57
57
# @api private
58
58
def load_relations
59
- command_compiler = CommandCompiler . new (
60
- configuration . gateways ,
61
- relations ,
62
- Registry . new ,
63
- notifications ,
64
- inflector : configuration . inflector
65
- )
66
-
67
59
components . relations . each do |component |
68
- relation = component . build ( command_compiler : command_compiler )
69
-
70
- relations . add ( component . key , relation )
60
+ relation = relations . add ( component . key , component . build )
71
61
72
62
notifications . trigger (
73
63
"configuration.relations.object.registered" ,
You can’t perform that action at this time.
0 commit comments