Project

using

0.0
No commit activity in last 3 years
No release in over 3 years
Flexibly load ruby files. This gem will automatically add File.expand_path(File.dirname(__FILE__) + "/my_mod/my_file") with a simple declaration. Uses non-obtrusive methods - it won't polute Object or Kernel (although you are free to, if you so choose). This also allows you to switch between require, load, and autoload on a project wide basis.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Runtime

>= 0
 Project Readme

Using¶ ↑

Automatically require files based on constant name and file name. Saves you the hassle of adding to $LOAD_PATH or using File.dirname(__FILE__) all over the place.

Also allows you to swap easily between require, load, and autoload within a drop of the hat.

Usage¶ ↑

in a file named ella.rb:

module Ella
  extend Using
  using :Foo     #=> require "ella/foo"
  using :FooBar  #=> require "ella/foo_bar"
end

The default load scheme is require. You can change the load scheme globally with Using.default_load_scheme = :autoload or Using.default_load_scheme = :load

Using.default_load_scheme = :autoload

using :Foo    #=> autoload :Foo,    "ella/foo"
using :FooBar #=> autoload :FooBar, "ella/foo_bar"

Or, say, you need to require just one file, but autoload the rest:

module MyProj
  Using.default_load_scheme = :autoload
  extend Using

  with_load_scheme :require do
    using :Errors
  end

  using :Routing
  using :Action
  using :Support
  using :Configuration
  using :RenderingEngines
  using :ApplicationHelpers
  using :Application
end

Dependencies:¶ ↑

facets

Source:¶ ↑

git://github.com/smtlaissezfaire/using.git

This software is released under the MIT & GPL Licenses.

Copyright © 2009 Scott Taylor <scott@railsnewbie.com>