module OpenStax::RescueFrom::ViewHelpers

Public Instance Methods

openstax_rescue_from_contact_info() click to toggle source
# 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