Class: David::AppConfig

Inherits:
Hash
  • Object
show all
Defined in:
lib/david/app_config.rb

Constant Summary collapse

DEFAULT_OPTIONS =
{
  :Block => true,
  :CBOR => false,
  :DefaultFormat => 'application/json',
  :Host => ENV['RACK_ENV'] == 'development' ? '::1' : '::',
  :Log => nil,
  :MinimalMapping => false,
  :Multicast => true,
  :Observe => true,
  :Port => ::CoAP::PORT
}

Instance Method Summary collapse

Constructor Details

#initialize(hash = {}) ⇒ AppConfig

Returns a new instance of AppConfig.



15
16
17
18
19
20
21
22
# File 'lib/david/app_config.rb', line 15

def initialize(hash = {})
  self.merge!(DEFAULT_OPTIONS)
  self.merge!(hash)

  (self.keys & DEFAULT_OPTIONS.keys).each do |key|
    optionize!(key)
  end
end