class IDRegistry::Railtie::Configuration

Configuration options. These are methods on config.idregistry.

Attributes

before_middleware[RW]

Middleware to run before, or nil to run the middleware toward the end

tasks[RW]

Array of registry tasks

Public Instance Methods

clear_registry(reg_, opts_={}, &condition_) click to toggle source

Set up the middleware to clear the given registry after each request.

If you provide the optional block, it is called and passed the Rack environment. The registry is cleared only if the block returns a true value. If no block is provided, the registry is always cleared at the end of a request.

If you set the :before_request option to true, the registry clearing will take place at the beginning of the request rather than the end.

# File lib/idregistry/railtie.rb, line 90
def clear_registry(reg_, opts_={}, &condition_)
  @tasks << RegistryMiddleware::ClearRegistry.new(reg_, opts_, &condition_)
  self
end
spawn_registry(template_, envkey_) click to toggle source

Set up the middleware to spawn a new registry on each request, using the given locked configuration as a template. The new registry is stored in the Rack environment with the given key. It is cleaned and disposed at the end of the request.

# File lib/idregistry/railtie.rb, line 101
def spawn_registry(template_, envkey_)
  @tasks << RegistryMiddleware::SpawnRegistry.new(template_, envkey_)
  self
end