aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_view
diff options
context:
space:
mode:
authorFlorent Guilleux <florent2@gmail.com>2012-12-01 14:43:39 -0500
committerFlorent Guilleux <florent2@gmail.com>2012-12-01 14:52:07 -0500
commitfb39249f368bca4563e31939a3439277201b641f (patch)
treea8ea3e78dafc8727aef3bd3b27c7f1ac1cb48ae5 /actionpack/lib/action_view
parent9bc16d0da2f699a7f67f243af4ff5b6b5d993c4a (diff)
downloadrails-fb39249f368bca4563e31939a3439277201b641f.tar.gz
rails-fb39249f368bca4563e31939a3439277201b641f.tar.bz2
rails-fb39249f368bca4563e31939a3439277201b641f.zip
Add documentation to AssetTagHelper#image_alt [ci skip]
Diffstat (limited to 'actionpack/lib/action_view')
-rw-r--r--actionpack/lib/action_view/helpers/asset_tag_helper.rb3
1 files changed, 3 insertions, 0 deletions
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