Project

loader

0.0
No commit activity in last 3 years
No release in over 3 years
easy to use File loader that allow directories/project both Lazy Load and Eager load for files and constants. The Eager load for relative directory made for gems by default
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

>= 0
>= 0
 Project Readme

loader

Ruby module for automatic file require based on convention :)

Introduction

Okey, before you even think about use this gem, let's say this gem only for lazy ones...

the basic idea is to have an easy to use relative require system and a namespace based Constant loading logic

The fun part is , that this stuffs can be used in gems (modules), because it do not depend on the Dir.pwd or any kind of absolute path or the File expand_path tricks that based on the application position.

The end goal is to make an easy ruby file loader for apps and gems.

Examples

load relative directory (not based on Dir.pwd but the caller files position) if you pass multiple string as argument it will be joined by file separator that the OS use

Manual loading folders

    require 'loader'

    # load all ruby file that was not loaded already
    # from that relative folder
    require_relative_directory "folder_name"

    # for recursive use try the following
    require_relative_directory_r "folder_name/path/etc"

Autoload folders

  require 'loader'
  Loader.autoload

optionally you can tell the project root folder if you work with in a gem.

  require 'loader'
  Loader.autoload(File.dirname(__FILE__))

If you like the basic idea that the app should not do any kind of Eager Load and become slow, you can use the constant based autoload function