Permalink
Browse files

Merge pull request #13072 from kuldeepaggarwal/unwanted-code

unnecessary checking of `size` with `second regex` if matched with former regex
  • Loading branch information...
2 parents fbe5baa + fff0309 commit f15bd23fdeabd7ca745bc6f4a77d36ef4aa606fd @fxn fxn committed Nov 27, 2013
Showing with 5 additions and 2 deletions.
  1. +5 −2 actionview/lib/action_view/helpers/asset_tag_helper.rb
@@ -208,8 +208,11 @@ def image_tag(source, options={})
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)

0 comments on commit f15bd23

Please sign in to comment.