@@ -9,12 +9,45 @@ class Configuration < ::Rails::Railtie::Configuration
9
9
attr_accessor :middleware , :javascript_path
10
10
attr_writer :eager_load_paths , :autoload_once_paths , :autoload_paths
11
11
12
+ # An array of custom autoload paths to be added to the ones defined
13
+ # automatically by Rails. These won't be eager loaded, unless you push
14
+ # them to +eager_load_paths+ too, which is recommended.
15
+ #
16
+ # This collection is empty by default, it accepts strings and +Pathname+
17
+ # objects.
18
+ #
19
+ # If you'd like to add +lib+ to it, please see +autoload_lib+.
20
+ attr_reader :autoload_paths
21
+
22
+ # An array of custom autoload once paths. These won't be eager loaded
23
+ # unless you push them to +eager_load_paths+ too, which is recommended.
24
+ #
25
+ # This collection is empty by default, it accepts strings and +Pathname+
26
+ # objects.
27
+ #
28
+ # If you'd like to add +lib+ to it, please see +autoload_lib_once+.
29
+ attr_reader :autoload_once_paths
30
+
31
+ # An array of custom eager load paths to be added to the ones defined
32
+ # automatically by Rails. Anything in this collection is considered to be
33
+ # an autoload path regardless of whether it was added to +autoload_paths+.
34
+ #
35
+ # This collection is empty by default, it accepts strings and +Pathname+
36
+ # objects.
37
+ #
38
+ # If you'd like to add +lib+ to it, please see +autoload_lib+.
39
+ attr_reader :eager_load_paths
40
+
12
41
def initialize ( root = nil )
13
42
super ( )
14
43
@root = root
15
44
@generators = app_generators . dup
16
45
@middleware = Rails ::Configuration ::MiddlewareStackProxy . new
17
46
@javascript_path = "javascript"
47
+
48
+ @autoload_paths = [ ]
49
+ @autoload_once_paths = [ ]
50
+ @eager_load_paths = [ ]
18
51
end
19
52
20
53
# Holds generators configuration:
@@ -81,16 +114,22 @@ def root=(value)
81
114
@root = paths . path = Pathname . new ( value ) . expand_path
82
115
end
83
116
84
- def eager_load_paths
85
- @eager_load_paths ||= paths . eager_load
117
+ # Private method that adds custom autoload paths to the ones defined by
118
+ # +paths+.
119
+ def all_autoload_paths # :nodoc:
120
+ autoload_paths + paths . autoload_paths
86
121
end
87
122
88
- def autoload_once_paths
89
- @autoload_once_paths ||= paths . autoload_once
123
+ # Private method that adds custom autoload once paths to the ones defined
124
+ # by +paths+.
125
+ def all_autoload_once_paths # :nodoc:
126
+ autoload_once_paths + paths . autoload_once
90
127
end
91
128
92
- def autoload_paths
93
- @autoload_paths ||= paths . autoload_paths
129
+ # Private method that adds custom eager load paths to the ones defined by
130
+ # +paths+.
131
+ def all_eager_load_paths # :nodoc:
132
+ eager_load_paths + paths . eager_load
94
133
end
95
134
end
96
135
end
0 commit comments