------ art_51292_17957026.1182198658653 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline On 6/18/07, Trans <transfire / gmail.com> wrote: > > > On Jun 18, 1:48 pm, Trans <transf... / gmail.com> wrote: > > > > module Kernel > > def express(name) > > extend self.class.const_get(name.to_s.capitalize) > > end > > end > > > > class Array > > module Random > > def shuffle > > [] # ... > > end > > > > def shuffle! > > replace(shuffle) > > end > > > > # ... > > end > > end > > > > a 1,2,3] > > a.shuffle # NoMethodError > > > > a.express(:Random) > > a.shuffle # [] > > FYI. I'm thinking about using this approach for Facets' Core > extensions in 2.0. There would be two versions of each require, one > that automatically includes the extension and one that does not. > > T. > > > I don't see it being worth it really. a.extend(Array::Random); a.shuffle What is this buying you? (Besides 6 characters, anyway) ------ art_51292_17957026.1182198658653--