From: Intransition on 20 Feb 2010 08:17 Hi-- I've been playing around with an alternative for loading dependent libraries in Ruby --something that's been sitting in the back of my mind for some time, but I hadn't taken the time to attempt a serious implementation until now. The core idea is pretty simple. Instead of loading a dependency into the toplevel, Bezel loads it into an anonymous module. This then gives the programmer a handle with which to use the library. This is done via the #lib method. Eg. Lets say you have a gem with this basic layout: lib/ foo.rb And foo.rb looks like: class FooThing ... end Then with 'bezel' pre-loaded: module MyApp FooDependency = lib('foo', '1.0') FooDependency::FooThing ... ... end This load technique completely removes any worry about version conflicts --you can use different versions of the same library in a single process. But this is a major shift in the way we are accustomed to loading libraries, so there are some important aspects to consider, such as core extensions being outside the scope of Bezel, and the need to use Bezel's #import method to load support files within a library. Learn more at: http://github.com/proutils/bezel
|
Pages: 1 Prev: NET:SSH fails authentification with :keys - ssh works Next: no investment earn part time |