aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorXavier Noria <fxn@hashref.com>2013-11-27 02:36:31 -0800
committerXavier Noria <fxn@hashref.com>2013-11-27 02:36:31 -0800
commitf15bd23fdeabd7ca745bc6f4a77d36ef4aa606fd (patch)
treeff2a5fa852bd4f67dc80521c6cb376d793338d8b
parentfbe5baa5b58eef3ec3e42c96ba8bd87f1ff97e65 (diff)
parentfff0309081219ec032ed08f0a4c3e61cacfafa37 (diff)
downloadrails-f15bd23fdeabd7ca745bc6f4a77d36ef4aa606fd.tar.gz
rails-f15bd23fdeabd7ca745bc6f4a77d36ef4aa606fd.tar.bz2
rails-f15bd23fdeabd7ca745bc6f4a77d36ef4aa606fd.zip
Merge pull request #13072 from kuldeepaggarwal/unwanted-code
unnecessary checking of `size` with `second regex` if matched with former regex
-rw-r--r--actionview/lib/action_view/helpers/asset_tag_helper.rb7
1 files changed, 5 insertions, 2 deletions
diff --git a/actionview/lib/action_view/helpers/asset_tag_helper.rb b/actionview/lib/action_view/helpers/asset_tag_helper.rb
index 2a44ae5d5c..b1ba9da4cf 100644
--- a/actionview/lib/action_view/helpers/asset_tag_helper.rb
+++ b/actionview/lib/action_view/helpers/asset_tag_helper.rb
@@ -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)