Class: Twigg::Config
- Inherits:
-
Object
- Object
- Twigg::Config
- Extended by:
- Forwardable
- Includes:
- Console
- Defined in:
- lib/twigg/config.rb
Overview
The Config class mediates all access to the Twigg config file.
First, we look for a YAML file at the location specified by the TWIGGRC environment variable. If that isn’t set, we fallback to looking for a config file at ‘~/.twiggrc`.
Example use:
Config.bind # the bind address for the Twigg web app
# [default: 0.0.0.0]
Config.gerrit.host # the (optional) Gerrit hostname
# [default: localhost]
Config.gerrit.port # the (optional) Gerrit port
# [default: 29418]
Config.gerrit.user # the (optional) Gerrit username
# [default: $USER environment variable]
Config.repositories_directory # where to find repositories
Class Method Summary collapse
-
.boot ⇒ Object
Perform boot-time configuration.
Instance Method Summary collapse
-
#initialize(twiggrc: nil) ⇒ Config
constructor
A new instance of Config.
Constructor Details
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, *args, &block) ⇒ Object (private)
Foward all messages to the underlying Settings instance.
68 69 70 |
# File 'lib/twigg/config.rb', line 68 def method_missing(method, *args, &block) @settings.send(method, *args, &block) end |
Class Method Details
.boot ⇒ Object
Perform boot-time configuration
35 36 37 38 |
# File 'lib/twigg/config.rb', line 35 def boot config # ensure `-c`/`--config` option is respected set_up_encoding end |