Method: Padrino::Helpers::AssetTagHelpers#image_alt

Defined in:
padrino-helpers/lib/padrino-helpers/asset_tag_helpers.rb

#image_alt(src) ⇒ String

Returns a string suitable for an alt attribute of img element.

Parameters:

  • src (String)

    The source path for the image tag.

Returns:

  • (String)

    The alt attribute value.

[View source] [View on GitHub]

223
224
225
# File 'padrino-helpers/lib/padrino-helpers/asset_tag_helpers.rb', line 223

def image_alt(src)
  File.basename(src, '.*').sub(/-[[:xdigit:]]{32,64}\z/, '').tr('-_', ' ').capitalize
end