module ReSorcery::Configuration

Configure ‘ReSorcery`: All configuration kept in one place

‘ReSorcery` has some values that can be configured by users. To keep such configuration clear, and to prevent confusing behavior, `#configure` can only be called once, and must be called before `include`ing `ReSorcery`.

Example:

ReSorcery.configure do
  link_rels ['self', 'create', 'update']
  link_methods ['get', 'post', 'put']
end

@see ‘Configuration::CONFIGURABLES` for a list of what can be configured and what value each configurable takes.

Constants

CONFIGURABLES

Public Instance Methods

configuration() click to toggle source
# File lib/re_sorcery/configuration.rb, line 28
def configuration
  @configuration ||= {}
end
configure(&block) click to toggle source
# File lib/re_sorcery/configuration.rb, line 32
def configure(&block)
  raise Error::InvalidConfigurationError, @configured if configured?

  @configured = "configured at #{caller_locations.first}"
  instance_exec(&block)
end

Private Instance Methods

configured?() click to toggle source
# File lib/re_sorcery/configuration.rb, line 41
def configured?
  @configured ||= false
end