37d96b2f82fe692420a6ef6df7f996adb8678760
1 module ActionView
#:nodoc:
2 class PathSet
< Array
#:nodoc:
3 def self.type_cast(obj
)
5 if Base
.cache_template_loading
?
6 Template
::EagerPath.new(obj
.to_s
)
8 ReloadableTemplate
::ReloadablePath.new(obj
.to_s
)
16 super(*args
).map
! { |obj
| self.class.type_cast(obj
) }
20 super(self.class.type_cast(obj
))
24 super(array
.map
! { |obj
| self.class.type_cast(obj
) })
27 def insert(index
, obj
)
28 super(index
, self.class.type_cast(obj
))
32 super(*objs
.map
{ |obj
| self.class.type_cast(obj
) })
36 super(*objs
.map
{ |obj
| self.class.type_cast(obj
) })
43 def find_template(original_template_path
, format
= nil, html_fallback
= true)
44 return original_template_path
if original_template_path
.respond_to
?(:render)
45 template_path
= original_template_path
.sub(/^\//, '')
48 if format
&& (template
= load_path
["#{template_path}.#{I18n.locale}.#{format}"])
50 elsif format
&& (template
= load_path
["#{template_path}.#{format}"])
52 elsif template
= load_path
["#{template_path}.#{I18n.locale}"]
54 elsif template
= load_path
[template_path
]
56 # Try to find html version if the format is javascript
57 elsif format
== :js && html_fallback
&& template
= load_path
["#{template_path}.#{I18n.locale}.html"]
59 elsif format
== :js && html_fallback
&& template
= load_path
["#{template_path}.html"]
64 return Template
.new(original_template_path
, original_template_path
=~
/\A\// ? "" : ".") if File
.file
?(original_template_path
)
66 raise MissingTemplate
.new(self, original_template_path
, format
)