Module: Shift::Api::Core
- Defined in:
- lib/shift/api/core.rb,
lib/shift/api/core/model.rb,
lib/shift/api/core/config.rb,
lib/shift/api/core/errors.rb,
lib/shift/api/core/version.rb,
lib/shift/api/core/request_id.rb,
lib/shift/api/core/formatters/logger.rb,
lib/shift/api/core/middleware/logger.rb,
lib/shift/api/core/middleware/inspector.rb,
lib/shift/api/core/middleware/error_handler.rb,
lib/shift/api/core/middleware/custom_headers.rb
Overview
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.
Defined Under Namespace
Modules: Errors, Formatters, Middleware Classes: Config, Model, RequestId
Constant Summary collapse
- ROOT_THREAD_VARS =
:"shift-api-core"
- VERSION =
"0.4.1"
Class Method Summary collapse
-
.config ⇒ Object
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.
- .config_instance ⇒ Object
-
.root_thread_vars ⇒ Hash
Global storage per thread for the gems to use where required.
Class Method Details
.config ⇒ Object
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.
22 23 24 25 26 27 |
# 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 ⇒ Object
35 36 37 |
# 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 ⇒ Hash
Global storage per thread for the gems to use where required.
31 32 33 |
# File 'lib/shift/api/core.rb', line 31 def self.root_thread_vars Thread.current[ROOT_THREAD_VARS] ||= {} end |