From: Marnen Laibow-Koser Date: 2009-12-17T08:27:15+09:00 Subject: Re: Split Module to multiple Files? Frank Guerino wrote: > Hi everyone, > > Thanks for your help on this. > > It appears that I have to clarify myself a little better (sorry about > that). I currently have one long main file that has "both" Classes and > Methods. The Methods are "not" in the Classes and are completely > stand-alone. No method is completely stand-alone in Ruby. Methods that appear to be stand-alone are actually defined on class Object, which everything else inherits from. And that's usually poor practice. You generally want to put your methods into an appropriate class. > > The above examples clearly show how to split Classes across multiple > files and I get how that works. Thank you for that. > > In addition to breaking Classes out to separate files and including them > through Modules, can I also split out the stand-alone "Methods" into > other files. Yes, but it would be more Rubyish if you found classes to put them into. > > The Methods are very long and the initial stages of the refactoring > effort include simply splitting the methods into separate files to > reduce the main file size. No. The initial refactoring should involve making the methods shorter. > > Can I somehow define Methods in separate files, aggregate them into a > Module and then Require that Module in my main file? > Yes. But you'd be better served to do this in a more OO way. > Thanks again for all your help. > > Frank Best, --  Marnen Laibow-Koser http://www.marnen.org marnen@marnen.org -- Posted via http://www.ruby-forum.com/.