module Shift::Api::Core

Shift::Api::Core

This gem is intended for “Shift API” gem authors to use. It provides the base methods etc.. in order to define models.

Constants

ROOT_THREAD_VARS
VERSION

Public Class Methods

config() { |config| ... } click to toggle source

The global configuration object If a block is passed into this method, it is yielded with the config object and all actions are performed from within the block as a batch - any action(s) that then need performing after a reconfigure are done once only.

# File lib/shift/api/core.rb, line 22
def self.config
  return config_instance unless block_given?
  config_instance.batch_configure do |config|
    yield(config)
  end
end
config_instance() click to toggle source
# File lib/shift/api/core.rb, line 35
def self.config_instance
  root_thread_vars[:config_instance] ||= Shift::Api::Core::Config.new
end
root_thread_vars() click to toggle source

Global storage per thread for the gems to use where required. @return [Hash] A hash which the caller is free to modify at will

# File lib/shift/api/core.rb, line 31
def self.root_thread_vars
  Thread.current[ROOT_THREAD_VARS] ||= {}
end