@@ -43,30 +43,13 @@ def render_views?
43
43
class EmptyTemplateResolver
44
44
def self . build ( path )
45
45
if path . is_a? ( ::ActionView ::Resolver )
46
- EmptyTemplateResolverDecorator . new ( path )
46
+ ResolverDecorator . new ( path )
47
47
else
48
- EmptyTemplateFileSystemResolver . new ( path )
48
+ FileSystemResolver . new ( path )
49
49
end
50
50
end
51
- end
52
-
53
- # Delegates find_templates to the submitted resolver and then returns templates
54
- # with modified source
55
- #
56
- # @private
57
- class EmptyTemplateResolverDecorator
58
- def initialize ( resolver )
59
- @resolver = resolver
60
- end
61
-
62
- def method_missing ( name , *args , &block )
63
- @resolver . send ( name , *args , &block )
64
- end
65
51
66
- private
67
-
68
- def find_templates ( *args )
69
- templates = @resolver . find_templates ( *args )
52
+ def self . nullify_template_rendering ( templates )
70
53
templates . map do |template |
71
54
::ActionView ::Template . new (
72
55
"" ,
@@ -77,24 +60,38 @@ def find_templates(*args)
77
60
)
78
61
end
79
62
end
80
- end
81
63
82
- # Delegates find_templates to the submitted path set and then returns
83
- # templates with modified source
84
- #
85
- # @private
86
- class EmptyTemplateFileSystemResolver < ::ActionView ::FileSystemResolver
87
- private
64
+ # Delegates find_templates to the submitted resolver and then returns templates
65
+ # with modified source
66
+ #
67
+ # @private
68
+ class ResolverDecorator
69
+ def initialize ( resolver )
70
+ @resolver = resolver
71
+ end
88
72
89
- def find_templates ( *args )
90
- super . map do |template |
91
- ::ActionView ::Template . new (
92
- "" ,
93
- template . identifier ,
94
- EmptyTemplateHandler ,
95
- :virtual_path => template . virtual_path ,
96
- :format => template . formats
97
- )
73
+ def method_missing ( name , *args , &block )
74
+ @resolver . send ( name , *args , &block )
75
+ end
76
+
77
+ private
78
+
79
+ def find_templates ( *args )
80
+ templates = @resolver . find_templates ( *args )
81
+ EmptyTemplateResolver . nullify_template_rendering ( templates )
82
+ end
83
+ end
84
+
85
+ # Delegates find_templates to the submitted path set and then returns
86
+ # templates with modified source
87
+ #
88
+ # @private
89
+ class FileSystemResolver < ::ActionView ::FileSystemResolver
90
+ private
91
+
92
+ def find_templates ( *args )
93
+ templates = super
94
+ EmptyTemplateResolver . nullify_template_rendering ( templates )
98
95
end
99
96
end
100
97
end
0 commit comments