class Muzak::Config

Muzak's static configuration dumping ground. Key-value pairs are loaded from {CONFIG_FILE} and translated from kebab-case to snake_case methods. @example

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

@see file:CONFIGURATION.md User Configuration

Constants

ALBUM_ART_REGEX

The regular expression that muzak uses to find album art.

CONFIG_DIR

The root directory for all user configuration, data, etc

CONFIG_FILE

Muzak's primary configuration file @see Muzak::Config

DEFAULT_CONFIG

The default configuration keys and values.

INDEX_FILE

Muzak's music index

MUSIC_SUFFIXES

All filename suffixes that muzak recognizes as music.

PLAYLIST_DIR

The directory for all user playlists

PLAYLIST_GLOB

The glob pattern for all user playlists

PLUGIN_EVENTS

All events currently propagated by {Muzak::Instance#event}

USER_COMMAND_DIR

The directory for all user commands

USER_COMMAND_GLOB

The glob pattern for all user commands

USER_PLUGIN_DIR

The directory for all user plugins

Public Class Methods

method_missing(method, *args) click to toggle source

Catches all undefined configuration keys and defaults them to false. @return [false]

Calls superclass method
# File lib/muzak/config.rb, line 101
def self.method_missing(method, *args)
  # this is basically useless, since respond_to_missing? will always be true,
  # but it gets RuboCop to shut up.
  if respond_to_missing? method, *args
    false
  else
    super
  end
end
plugin?(pname) click to toggle source

@return [Boolean] whether or not the given plugin is configured @note the truth-value of this method is used in part to determine which

plugins should be loaded.
# File lib/muzak/config.rb, line 120
def self.plugin?(pname)
  respond_to? "plugin_#{pname}"
end
resolve_command(cmd) click to toggle source

Convert the given command into a method (kebab to camel case). @param cmd [String] the command to convert @return [String] the method corresponding to the command @example

resolve_command "do-something" # => "do_something"
# File lib/muzak/config.rb, line 86
def self.resolve_command(cmd)
  cmd.tr "-", "_"
end
resolve_method(meth) click to toggle source

Convert the given method into a command (camel to kebab case). @param meth [String, Symbol] the method to convert @return [String] the command corresponding to the method @example

resolve_method "do_something" # => "do-something"
# File lib/muzak/config.rb, line 95
def self.resolve_method(meth)
  meth.to_s.tr "_", "-"
end
respond_to_missing?(*_args) click to toggle source

We “respond” to all methods with a default of false, so this is always true. @return [true]

# File lib/muzak/config.rb, line 113
def self.respond_to_missing?(*_args)
  true
end