module Accessible::Bootstrap3::Rails::ViewHelpers

Public Instance Methods

page_header(header) click to toggle source
# File lib/accessible/bootstrap3/rails/view_helper.rb, line 11
def page_header(header)
  content_for(:page_header) {wrap_abbreviations(header)}
end
wrap_abbreviations(string) click to toggle source
# File lib/accessible/bootstrap3/rails/view_helper.rb, line 5
def wrap_abbreviations(string)
  string.enum_for(:scan, /([A-Z]{2,})/).reduce(string) do |acc, _|
    acc.gsub $1, "<abbr title='#{$1.chars.to_a.join(' ')}'><span aria-hidden='true'>#{$1}</span></abbr>"
  end.html_safe
end