class ShopifyURL::Linker

Attributes

host[R]

Public Class Methods

new(shop) click to toggle source
# File lib/shopify_url.rb, line 9
def initialize(shop)
  raise ArgumentError, "shop required" if empty?(shop)

  @host = shop.dup
  @host.prepend("https://") unless @host =~ %r{\Ahttps?://}i
end

Public Instance Methods

inspect()
Alias for: to_s
to_s() click to toggle source
# File lib/shopify_url.rb, line 16
def to_s
  @host.dup
end
Also aliased as: to_str, inspect
to_str()
Alias for: to_s

Protected Instance Methods

empty?(s) click to toggle source
# File lib/shopify_url.rb, line 32
def empty?(s)
  s.to_s.strip.empty?
end
id_required!(id) click to toggle source
# File lib/shopify_url.rb, line 27
def id_required!(id)
  # Add caller to remove this frame from stack
  raise ArgumentError, "id required", caller if id.to_s.strip.empty?
end
q(params) click to toggle source
# File lib/shopify_url.rb, line 36
def q(params)
  return unless params && params.respond_to?(:to_a)
  URI.encode_www_form(params.to_a)
end