lib/masterview/directive_helpers.rb in masterview-0.1.5 vs lib/masterview/directive_helpers.rb in masterview-0.2.0
- old
+ new
@@ -21,14 +21,16 @@
UltraLow = (0x3FFFFFFF/16)*15
Lowest = 0x3FFFFFFF
end
# convert render_partial_name to file_name, ex foo/bar to foo/_bar.rhtml
- def render_partial_name_to_file_name(render_partial_name)
- dir = File.dirname(render_partial_name)
- base = File.basename(render_partial_name, PartialExtension)
- filename = '_'+base+PartialExtension
- path = ( (dir != '.') ? File.join(dir,filename) : filename )
+ def render_partial_name_to_file_name(render_partial_name, default_extension)
+ pathname = Pathname.for_path(render_partial_name)
+ dir_pathname = pathname.dirname
+ base = pathname.basename(pathname.extname).to_s
+ filename = '_'+base
+ filename += default_extension if default_extension
+ path = (dir_pathname+filename).to_s
end
# find the last string that fully matches exactly the
# parent tags content string array