Class: Muzak::Config
- Inherits:
-
Object
- Object
- Muzak::Config
- Defined in:
- lib/muzak/config.rb
Overview
Muzak's static configuration dumping ground. Key-value pairs are loaded from CONFIG_FILE and translated from kebab-case to snake_case methods.
Class Method Summary collapse
-
.method_missing(method, *args) ⇒ false
Catches all undefined configuration keys and defaults them to false.
-
.plugin?(pname) ⇒ Boolean
Whether or not the given plugin is configured.
-
.sync! ⇒ void
Synchronizes the in-memory configuration with CONFIG_FILE.
Class Method Details
.method_missing(method, *args) ⇒ false
Catches all undefined configuration keys and defaults them to false.
46 47 48 |
# File 'lib/muzak/config.rb', line 46 def self.method_missing(method, *args) false end |
.plugin?(pname) ⇒ Boolean
Note:
the truth-value of this method is used to determine which plugins should be loaded.
Returns whether or not the given plugin is configured.
59 60 61 |
# File 'lib/muzak/config.rb', line 59 def self.plugin?(pname) respond_to? "plugin_#{pname}" end |
.sync! ⇒ void
This method returns an undefined value.
Synchronizes the in-memory configuration with Muzak::CONFIG_FILE.
52 53 54 |
# File 'lib/muzak/config.rb', line 52 def self.sync! File.open(CONFIG_FILE, "w") { |io| io.write @config.to_yaml } end |