class ApiRecipes::Configuration

Attributes

log_level[RW]
log_to[RW]
print_urls[RW]

Public Instance Methods

apis_configs() click to toggle source
# File lib/api_recipes/configuration.rb, line 12
def apis_configs
  unless @apis_configs
    @apis_configs = {}
  end
  @apis_configs
end
apis_configs=(configs = {}) click to toggle source
# File lib/api_recipes/configuration.rb, line 6
def apis_configs=(configs = {})
  raise ArgumentError, 'apis_configs must be an Hash' unless configs.is_a? Hash
  @apis_configs = configs.deep_symbolize_keys
  ApiRecipes._aprcps_define_global_apis
end
logger() click to toggle source
# File lib/api_recipes/configuration.rb, line 23
def logger
  unless @logger
    log = ::Logger.new(log_to)
    log.level    = normalize_log_level
    log.progname = 'ApiRecipes'
    @logger = log
  end

  @logger
end
logger=(logger) click to toggle source
# File lib/api_recipes/configuration.rb, line 19
def logger=(logger)
  @logger = logger
end

Private Instance Methods

normalize_log_level() click to toggle source

@private

# File lib/api_recipes/configuration.rb, line 37
def normalize_log_level
  case @log_level
  when :debug, ::Logger::DEBUG, 'debug' then ::Logger::DEBUG
  when :info,  ::Logger::INFO,  'info'  then ::Logger::INFO
  when :warn,  ::Logger::WARN,  'warn'  then ::Logger::WARN
  when :error, ::Logger::ERROR, 'error' then ::Logger::ERROR
  when :fatal, ::Logger::FATAL, 'fatal' then ::Logger::FATAL
  else
    Logger::ERROR
  end
end