Class: PostDB::Configuration
- Inherits:
-
Object
- Object
- PostDB::Configuration
- Defined in:
- lib/postdb/configuration.rb
Class Method Summary collapse
-
.[](name) ⇒ Object
Get a value from the configuration.
-
.load_file(path) ⇒ Object
Load the configuration from a file.
Class Method Details
.[](name) ⇒ Object
Get a value from the configuration
Arguments:
name: (String)
Example:
>> PostDB::Configuration[:database]
=> { ... }
28 29 30 31 32 |
# File 'lib/postdb/configuration.rb', line 28 def [](name) return nil unless @configuration @configuration[name] end |
.load_file(path) ⇒ Object
Load the configuration from a file
Arguments:
path: (String) The path to the configuration file
Example:
>> PostDB::Configuration.load_file(path)
=> true
13 14 15 16 17 |
# File 'lib/postdb/configuration.rb', line 13 def load_file(path) @configuration = YAML.load(File.read(path)) true end |