This repository is private.
All pages are served over SSL and all pushing and pulling is done over SSH.
No one may fork, clone, or view it unless they are added as a member.
Every repository with this icon (
) is private.
Every repository with this icon (
This repository is public.
Anyone may fork, clone, or view it.
Every repository with this icon (
) is public.
Every repository with this icon (
Greg Weber (author)
Sat Nov 01 18:51:26 -0700 2008
commit c0604feeac9f1a1630b8b90b8e6a568cbd15131a
tree 3ce25b7c92b849b0ad6c6bdc918869bb5c5b4aaf
parent 72a07950af12ac69af65b61cf63df374ed3ab23f parent a13b5e8f7191ec0d631065a826de6a67511e96b3
tree 3ce25b7c92b849b0ad6c6bdc918869bb5c5b4aaf
parent 72a07950af12ac69af65b61cf63df374ed3ab23f parent a13b5e8f7191ec0d631065a826de6a67511e96b3
| name | age | message | |
|---|---|---|---|
| |
README | Fri Mar 14 18:30:34 -0700 2008 | |
| |
Rakefile | Sat Nov 01 18:50:40 -0700 2008 | |
| |
lib/ | Tue Oct 14 12:37:06 -0700 2008 | |
| |
spec/ | Fri Apr 18 16:29:17 -0700 2008 | |
| |
tasks/ |
README
== Summary selectively include module methods with Kernel#import == Author and License Copyright (c) 2008 Greg Weber, http://gregweber.info Licensed under the MIT license == Usage require 'rubygems' require 'module-import' module Foo def foo; 'foo' end def bar; 'bar' end end class Importer import Foo, :bar end Importer.new.bar # => 'bar' Importer.new.foo # => # NoMethodError class Importer import Foo, :not_defined # => #not_defined not found in Foo (ImportError) end Giving no methods (or all methods) should behave the same as a normal include class Importer2 import Foo # same as import Foo, :foo, :bar end Importer2.new.bar # => 'bar' Importer2.new.foo # => 'foo' However, there is one important difference. New changes in the included module will not effect the class. module Foo undef_method :foo def bar; fail end end Importer2.new.bar # => 'bar' Importer2.new.foo # => 'foo' == WARNING! There is no way for Kernel#import to track dependencies between methods! To help with this, by default, all private methods from the module will be imported unless the option :import_private is set to false To write a module that works with this system well, your public methods should depend only on private methods. To use this on someone else's module, you should either import the full module or write tests or inspect the source code of the module you are importing. == Install gem install module-import == Source === browser http://github.com/gregwebs/module-import/tree/master === repository git clone git://github.com/gregwebs/module-import.git == Homepage http://gregweber.info/projects/module-import.html == RDoc documentation included with the gem == Notes === Testing 4:1 test:code ratio, I think I have all the corner cases covered. In particular, this does not break inheritance and everything works the same for importing into a module as it does for importing into class. === Implementation Includes a duplicate of the module that has methods removed









