1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Removed unnecessary calls to image_path and hash lookups [#2827 state:resolved]

This commit is contained in:
Yehuda Katz + Carl Lerche 2009-07-02 12:14:23 -07:00
parent d036899717
commit 0fbf458b6c

View file

@ -505,8 +505,8 @@ module ActionView
def image_tag(source, options = {})
options.symbolize_keys!
options[:src] = path_to_image(source)
options[:alt] ||= File.basename(options[:src], '.*').split('.').first.to_s.capitalize
src = options[:src] = path_to_image(source)
options[:alt] ||= File.basename(src, '.*').split('.').first.to_s.capitalize
if size = options.delete(:size)
options[:width], options[:height] = size.split("x") if size =~ %r{^\d+x\d+$}
@ -514,7 +514,7 @@ module ActionView
if mouseover = options.delete(:mouseover)
options[:onmouseover] = "this.src='#{image_path(mouseover)}'"
options[:onmouseout] = "this.src='#{image_path(options[:src])}'"
options[:onmouseout] = "this.src='#{src}'"
end
tag("img", options)