From: Mike Gold Date: 2009-02-06T23:50:08+09:00 Subject: Re: Making object methods available externally Rick Denatale wrote: > Ruby does have a method Module#module_function which can be used in > cases similar to this. For a rather silly example: > > module Test > def foo > puts "Foo" > end > > module_function :foo > end To make a minor point, I see this use of module_function often, even in the standard library. I don't like it. In addition to the module_function method, there's the module_function scoping state, like public or private or protected, which is likewise enabled by calling module_function without arguments. Therefore we can make a D.R.Y. equivalent: module Test module_function def foo puts "Foo" end end -- Posted via http://www.ruby-forum.com/.