From fb39249f368bca4563e31939a3439277201b641f Mon Sep 17 00:00:00 2001 From: Florent Guilleux Date: Sat, 1 Dec 2012 14:43:39 -0500 Subject: Add documentation to AssetTagHelper#image_alt [ci skip] --- actionpack/lib/action_view/helpers/asset_tag_helper.rb | 3 +++ 1 file changed, 3 insertions(+) (limited to 'actionpack/lib/action_view') diff --git a/actionpack/lib/action_view/helpers/asset_tag_helper.rb b/actionpack/lib/action_view/helpers/asset_tag_helper.rb index 9f19cd8d15..dd837ebba5 100644 --- a/actionpack/lib/action_view/helpers/asset_tag_helper.rb +++ b/actionpack/lib/action_view/helpers/asset_tag_helper.rb @@ -210,6 +210,9 @@ module ActionView 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 -- cgit v1.2.3