Module: OpenStax::RescueFrom::ViewHelpers

Defined in:
lib/openstax/rescue_from/view_helpers.rb

Instance Method Summary collapse

Instance Method Details

#openstax_rescue_from_contact_infoObject



4
5
6
7
8
9
10
11
12
13
14
15
# File 'lib/openstax/rescue_from/view_helpers.rb', line 4

def openstax_rescue_from_contact_info
  info = OpenStax::RescueFrom.configuration.contact_name

  if info.match(/\S+@\S+\.\w{2,4}/)
    mail_to info
  elsif info.match(/\S+\.\w{2,4}\z/)
    info = info.match(/\Ahttps?:\/\//) ? info : "http://#{info}"
    link_to info, info
  else
    info
  end
end