Class: Spree::PageLink

Inherits:
Object
  • Object
show all
Defined in:
app/models/spree/page_link.rb

Instance Method Summary collapse

Instance Method Details

#formatted_urlObject



31
32
33
34
35
36
# File 'app/models/spree/page_link.rb', line 31

def formatted_url
  return if url.blank?
  return url if %w[mailto: tel:].any? { |protocol| url.start_with?(protocol) }

  @formatted_url ||= url.match(/http:\/\/|https:\/\//) ? url : "http://#{url}"
end

#linkable_urlObject



27
28
29
# File 'app/models/spree/page_link.rb', line 27

def linkable_url
  @linkable_url ||= linkable&.page_builder_url || formatted_url
end