Permalink
Browse files

Add documentation to AssetTagHelper#image_alt [ci skip]

  • Loading branch information...
1 parent 9bc16d0 commit fb39249f368bca4563e31939a3439277201b641f Florent Guilleux committed Dec 1, 2012
Showing with 3 additions and 0 deletions.
  1. +3 −0 actionpack/lib/action_view/helpers/asset_tag_helper.rb
@@ -210,6 +210,9 @@ def image_tag(source, options={})
tag("img", options)
end
+ # Returns a string suitable for an html image tag alt attribute.
+ # +src+ is meant to be an image file path.
+ # It removes the basename of the file path and the digest, if any.
def image_alt(src)
File.basename(src, '.*').sub(/-[[:xdigit:]]{32}\z/, '').capitalize
end

0 comments on commit fb39249

Please sign in to comment.