From: Trans Date: 2006-08-18T00:10:09+09:00 Subject: Re: using a module at the toplevel doesn't work Logan Capaldo wrote: > On Aug 17, 2006, at 9:20 AM, Trans wrote: > > > Why? Becuase the module uses #define_method, and #define_method isn't > > defined in main. > > > > Which brings me to two questions: > > > > 1. How do I get around this problem? Please save me from having to > > delgate the whole module! > > > irb(main):006:0> case self > irb(main):007:1> when Module, Class > irb(main):008:1> define_method(:a) { 1 } > irb(main):009:1> else > irb(main):010:1* (class << self; self; end).class_eval > { define_method(:a) { 1 } } > irb(main):011:1> end That's what I want to avoid -- "delegating the whole module" :-( > > 2. Why isn't main a self extended module to begin with? Honestly, this > > question has been buigging me for a long time. > > > Couldn't tell you. Matz? T.