[Nitro] A better #is ?
George Moschovitis
george.moschovitis at gmail.com
Fri Jul 27 10:32:54 EDT 2007
It looks cool, and I can't see any problems...
-g.
On 7/27/07, Trans <transfire at gmail.com> wrote:
>
> Maybe I hit one something... a slight variation on #is.
>
> class Module
>
> # Default append function is #include.
> def is(*modules)
> module.each do { |m|
> if m.respond_to?(:append_feature_function)
> send(m.append_feature_function,m)
> else
> include m
> end
> end
> end
>
> end
>
> Example:
>
> module Foo
> def self.append_feature_function
> :extend
> end
>
> def x; "x"; end
> end
>
> class Bar
> is Foo
> end
>
> Bar.x #=> "x"
>
> Thoughts?
>
> T.
>
> _______________________________________________
> Nitro-general mailing list
> Nitro-general at rubyforge.org
> http://rubyforge.org/mailman/listinfo/nitro-general
>
--
http://www.me.gr
http://phidz.com
http://blog.gmosx.com
http://cull.gr
http://www.joy.gr
http://nitroproject.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://rubyforge.org/pipermail/nitro-general/attachments/20070727/9a13e461/attachment.html
More information about the Nitro-general
mailing list