ara.t.howard / noaa.gov wrote: > On Sun, 10 Dec 2006, Trans wrote: > > > i came upon this "pattern" working on a rather difficult problem. see > > if you can wrap your head around this bending of ruby space and what it > > might be good for. > > > > module R; end > > module U; include R; end > > module R; extend U; end > > one side effect is that all instance methods of R are available at the module > level too. i generally do that this way: > > harp:~ > cat a.rb > class Module > def export meth > module_function meth > public meth > end > end > > module R > def foo() 42 end > export :foo > end > > p R.foo > > harp:~ > ruby a.rb > 42 speaking of this "export" method, how does one do that for a whole module? ie. adding one module_finction module to another. module X module_function def f; "f"; end end module Q module_function include X extend X end but that doesn't work b/c Q.f #=> ERROR: private method `f' called for Q:Module t.