module Smooth::Api::Tracking

Public Instance Methods

apis() click to toggle source
# File lib/smooth/api/tracking.rb, line 4
def apis
  @@apis ||= {}
end
current_api() click to toggle source
# File lib/smooth/api/tracking.rb, line 18
def current_api
  apis[current_api_name] ||= Smooth::Api.default
end
current_api_name() click to toggle source
# File lib/smooth/api/tracking.rb, line 26
def current_api_name
  (@@current_api_name ||= :default).to_sym
end
current_api_name=(value) click to toggle source
# File lib/smooth/api/tracking.rb, line 22
def current_api_name=(value)
  @@current_api_name = value
end
fetch_api(name, &block) click to toggle source
# File lib/smooth/api/tracking.rb, line 8
def fetch_api(name, &block)
  existing = apis[name.to_sym]

  if existing.nil? && block_given?
    existing = apis[name.to_sym] = block.call(name.to_sym)
  end

  existing
end