class AdventureRL::Clip

Constants

IMAGE_FILENAME_REGEX
INTERNAL_DEFAULT_SETTINGS

Public Class Methods

default_settings=(settings)
get_root_directory() click to toggle source

Returns the currently set root images directory.

# File lib/AdventureRL/Clip.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/Clip.rb, line 57
def initialize settings
  super
  audio_settings = get_settings :audio
  @audio = load_audio audio_settings  if (audio_settings)
end
root()
Alias for: get_root_directory
root=(directory)
Alias for: set_root_directory
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/Clip.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 images 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/Clip.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=

Public Instance Methods

get_audio() click to toggle source

Returns this Clip's Audio, if one was provided at new.

# File lib/AdventureRL/Clip.rb, line 64
def get_audio
  return @audio
end
has_audio?() click to toggle source

Returns true if this Clip has Audio.

# File lib/AdventureRL/Clip.rb, line 69
def has_audio?
  return !!get_audio
end

Private Instance Methods

get_default_settings() click to toggle source

Returns this class' specific INTERNAL_DEFAULT_SETTINGS.

# File lib/AdventureRL/Clip.rb, line 81
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/Clip.rb, line 87
def get_filename_regex
  return IMAGE_FILENAME_REGEX
end
load_audio(audio_settings) click to toggle source

Loads Audio, if one was provided

# File lib/AdventureRL/Clip.rb, line 76
def load_audio audio_settings
  return Audio.new audio_settings
end