Permalink
Browse files

unnecessary checking of `size` with `second regex` if matched with fi…

…rst one
  • Loading branch information...
1 parent 260471a commit fff0309081219ec032ed08f0a4c3e61cacfafa37 @kuldeepaggarwal kuldeepaggarwal committed Nov 27, 2013
Showing with 5 additions and 2 deletions.
  1. +5 −2 actionview/lib/action_view/helpers/asset_tag_helper.rb
View
7 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 fff0309

Please sign in to comment.