module AdventureRL

This file purely requires code files.

Constants

DEFAULT_SETTINGS

Default gem settings defined in default_settings.yml.

DIR

A constant containing a bunch of directories or files.

ROOT

The root directory of the gem. Used for requiring ruby files.

VERSION

Public Class Methods

require_dir(dir, options = {}) click to toggle source
# File lib/AdventureRL/misc/require_files.rb, line 3
def self.require_dir dir, options = {}
  directory = Pathname.new dir.to_s
  Helpers::Error.error_no_directory directory  unless (Helpers::Error.directory_exists? directory)
  options[:priority] = [options[:priority]].flatten.compact
  options[:priority].map! do |filename|
    next directory.join("#{filename.sub(/\.rb\z/,'')}.rb")
  end
  directory.children.sort_by_array(options[:priority]).each do |file|
    filepath = file.to_path
    require filepath  if (filepath.match?(/\.rb\z/))
  end
end