class AdventureRL::Audio
Constants
- AUDIO_FILENAME_REGEX
- INTERNAL_DEFAULT_SETTINGS
Public Class Methods
get_root_directory()
click to toggle source
Returns the currently set root audio files directory.
# File lib/AdventureRL/Audio.rb, line 25 def get_root_directory return @@root_directory end
Also aliased as: root
new(settings)
click to toggle source
Initialize with either a path to a YAML settings file as a String, or a Hash containing your settings.
Calls superclass method
# File lib/AdventureRL/Audio.rb, line 58 def initialize settings super end
set_default_settings(settings)
click to toggle source
Set the default Settings
. Pass either String to a YAML settings file, or a Hash with your default settings.
# File lib/AdventureRL/Audio.rb, line 33 def set_default_settings settings default_settings = nil if ([String, Pathname].include? settings.class) filepath = settings filepath = Pathname.new filepath unless (filepath.is_a? Pathname) if (filepath.absolute?) default_settings = Settings.new filepath else if (File.file?(filepath)) default_settings = Settings.new filepath else default_settings = Settings.new get_root_directory.join(filepath) end end elsif (settings.is_a? Hash) default_settings = Settings.new settings end @@default_settings = default_settings end
Also aliased as: default_settings=
set_root_directory(directory)
click to toggle source
Set the root directory for the audio files directory. All settings 'directory' values will be relative to this. Defaults to the entry scripts (the script that was called, $0
) directory. Pass either a String with the directory path, or an instance of Pathname.
# File lib/AdventureRL/Audio.rb, line 18 def set_root_directory directory directory = Pathname.new directory unless (directory.is_a? Pathname) @@root_directory = Pathname.new directory end
Also aliased as: root=
Private Instance Methods
get_default_settings()
click to toggle source
Returns this class' specific INTERNAL_DEFAULT_SETTINGS
.
# File lib/AdventureRL/Audio.rb, line 65 def get_default_settings return INTERNAL_DEFAULT_SETTINGS.merge @@default_settings if (@@default_settings) return INTERNAL_DEFAULT_SETTINGS end
get_filename_regex()
click to toggle source
Should return the regex which must match the filenames.
# File lib/AdventureRL/Audio.rb, line 71 def get_filename_regex return AUDIO_FILENAME_REGEX end