module Qiniu::Config

Constants

DEFAULT_OPTIONS
REQUIRED_OPTION_KEYS

Attributes

default_params[R]
settings[R]

Public Class Methods

initialize_connect(options = {}) click to toggle source
# File lib/qiniu/config.rb, line 50
def initialize_connect options = {}
  @settings = DEFAULT_OPTIONS.merge!(options)
  REQUIRED_OPTION_KEYS.each do |opt|
    raise MissingArgsError, [opt] unless @settings.has_key?(opt)
  end
end
load(config_file) click to toggle source
# File lib/qiniu/config.rb, line 40
def load config_file
  if File.exist?(config_file)
    config_options = YAML.load_file(config_file)
    config_options.symbolize_keys!
    initialize_connect(config_options)
  else
    raise MissingConfError, config_file
  end
end