class FoxycartHelpers::Javascript

Public Class Methods

html_element(*args) click to toggle source
# File lib/foxycart_helpers/javascript.rb, line 10
def self.html_element(*args)
  new(*args).html_element
end
url(*args) click to toggle source
# File lib/foxycart_helpers/javascript.rb, line 6
def self.url(*args)
  new(*args).url
end

Public Instance Methods

config() click to toggle source
# File lib/foxycart_helpers/javascript.rb, line 27
def config
  FoxycartHelpers.configuration
end
html_element() click to toggle source
# File lib/foxycart_helpers/javascript.rb, line 18
def html_element
  "<script src=\"#{url}\" async defer></script>"
end
subdomain() click to toggle source
# File lib/foxycart_helpers/javascript.rb, line 22
def subdomain
  url = URI.parse config.url
  url.host.split('.').first
end
url() click to toggle source
# File lib/foxycart_helpers/javascript.rb, line 14
def url
  "https://cdn.foxycart.com/#{subdomain}/loader.js"
end