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

unnecessary checking of size with second regex if matched with first one

This commit is contained in:
Kuldeep Aggarwal 2013-11-27 15:51:47 +05:30
parent 260471a5e1
commit fff0309081

View file

@ -208,8 +208,11 @@ module ActionView
end
if size = options.delete(:size)
options[:width], options[:height] = size.split("x") if size =~ %r{\A\d+x\d+\z}
options[:width] = options[:height] = size if size =~ %r{\A\d+\z}
if size =~ %r{\A\d+x\d+\z}
options[:width], options[:height] = size.split('x')
elsif size =~ %r{\A\d+\z}
options[:width] = options[:height] = size
end
end
tag("img", options)