Class: Muzak::Config

Inherits:
Object
  • Object
show all
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.

Examples:

# corresponds to `art-geometry: 300x300` in configuration
Config.art_geometry # => "300x300"

See Also:

Class Method Summary collapse

Class Method Details

.method_missing(method, *args) ⇒ false

Catches all undefined configuration keys and defaults them to false.

Returns:

  • (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.

Returns:

  • (Boolean)

    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