ways to define a global method in ruby
问题 I'm writing a small gem, and I want to define a DSL-like method, pretty much the same as the desc and task methods in Rake . Rake defines them as private methods in the Rake::DSL module and then self.extend Rake::DSL to mix the module into the main object? (I'm a newbie and go ahead laugh if I'm wrong) what are the benefits by doing so? is it because making these methods private can prevent any other objects to use them (that is, to prevent something like some_obj.desc ) ? what if I define