From: Trans Date: 2007-06-19T04:45:57+09:00 Subject: Re: Means of Optional Expression On Jun 18, 1:48 pm, Trans 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.