module Dynamoid::Config

Contains all the basic configuration information required for Dynamoid: both sensible defaults and required fields. @private

Constants

DEFAULT_NAMESPACE

@since 3.3.1

Public Instance Methods

build_backoff() click to toggle source
# File lib/dynamoid/config.rb, line 89
def build_backoff
  if backoff.is_a?(Hash)
    name = backoff.keys[0]
    args = backoff.values[0]

    backoff_strategies[name].call(args)
  else
    backoff_strategies[backoff].call
  end
end
default_logger() click to toggle source

The default logger for Dynamoid: either the Rails logger or just stdout.

@since 0.2.0

# File lib/dynamoid/config.rb, line 66
def default_logger
  defined?(Rails) && Rails.respond_to?(:logger) ? Rails.logger : ::Logger.new($stdout)
end
logger() click to toggle source

Returns the assigned logger instance.

@since 0.2.0

# File lib/dynamoid/config.rb, line 73
def logger
  @logger ||= default_logger
end
logger=(logger) click to toggle source

If you want to, set the logger manually to any output you’d like. Or pass false or nil to disable logging entirely.

@since 0.2.0

# File lib/dynamoid/config.rb, line 80
def logger=(logger)
  case logger
  when false, nil then @logger = ::Logger.new(nil)
  when true then @logger = default_logger
  else
    @logger = logger if logger.respond_to?(:info)
  end
end