Files
openfoodnetwork/app/helpers/groups_helper.rb
Matt-Yorkley 1d5077061e Remove andand
This old gem implemented some functionality for handling nils which is no longer needed, as it's provided natively by Ruby with the &. operator.
2021-09-08 14:28:31 +01:00

23 lines
436 B
Ruby

# frozen_string_literal: true
module GroupsHelper
def link_to_service(baseurl, name, html_options = {}, &block)
return if name.blank?
html_options = html_options.merge target: '_blank'
link_to ext_url(baseurl, name), html_options, &block
end
def ext_url(prefix, url)
if url =~ %r{^https?://}i
url
else
prefix + url
end
end
def strip_url(url)
url&.sub(%r{^https?://}i, '')
end
end