Class: RequestHandler::Config
- Inherits:
-
Object
- Object
- RequestHandler::Config
- Defined in:
- lib/request_handler/config.rb
Instance Attribute Summary collapse
-
#config ⇒ Object
Returns the value of attribute config.
Instance Method Summary collapse
-
#initialize(&block) ⇒ Config
constructor
A new instance of Config.
- #lookup(key) ⇒ Object
- #lookup!(key) ⇒ Object
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
#config ⇒ Object
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 |