Class: Bkblz::Config
- Inherits:
-
Object
- Object
- Bkblz::Config
- Defined in:
- lib/bkblz/config.rb
Constant Summary collapse
- CONFIG_VARS =
{ :application_key => '', :account_id => '', :debug_http => false, :log_device => :stderr, # [:stdout, :stderr, :devnull, path, fd] :log_level => :warn, # [:debug, :info, :warn, :error, :fatal, (-6..-1)] :log_colorize => true }.freeze
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(**config_map) ⇒ Config
constructor
A new instance of Config.
Constructor Details
#initialize(**config_map) ⇒ Config
Returns a new instance of Config.
17 18 19 20 21 22 23 24 |
# File 'lib/bkblz/config.rb', line 17 def initialize(**config_map) config_map.each do |k,v| # allows attr_reader methods from CONFIG_VAR to work instance_variable_set :"@#{k}", v end @config_map = config_map end |
Class Method Details
.configure(config = nil, &block) ⇒ Object
27 28 29 30 31 |
# File 'lib/bkblz/config.rb', line 27 def configure(config=nil, &block) map = config ? config.config_map : CONFIG_VARS.dup map = yield map if block_given? Config.new map end |