From fff0309081219ec032ed08f0a4c3e61cacfafa37 Mon Sep 17 00:00:00 2001 From: Kuldeep Aggarwal Date: Wed, 27 Nov 2013 15:51:47 +0530 Subject: unnecessary checking of `size` with `second regex` if matched with first one --- actionview/lib/action_view/helpers/asset_tag_helper.rb | 7 +++++-- 1 file 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) -- cgit v1.2.3