Class: RequestHandler::Config

Inherits:
Object
  • Object
show all
Defined in:
lib/request_handler/config.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(&block) ⇒ Config

Returns a new instance of Config.



7
8
9
# File 'lib/request_handler/config.rb', line 7

def initialize(&block)
  @config = Docile.dsl_eval(RequestHandler::Builder::OptionsBuilder.new, &block).build
end

Instance Attribute Details

#configObject

Returns the value of attribute config.



11
12
13
# File 'lib/request_handler/config.rb', line 11

def config
  @config
end

Instance Method Details

#lookup(key) ⇒ Object



17
18
19
# File 'lib/request_handler/config.rb', line 17

def lookup(key)
  @config.dig(*symbolize_key(key))
end

#lookup!(key) ⇒ Object



13
14
15
# File 'lib/request_handler/config.rb', line 13

def lookup!(key)
  lookup(key) || (raise NoConfigAvailableError, key.to_sym => 'is not configured')
end