On Wed, 16 Dec 2009 23:33:29 +0900, Brian Candler wrote:

> Frank Guerino wrote:
>> I've just started writing Ruby and have a very long file of, both,
>> methods and files.  I understand the above file partitioning
>> methodology for classes.  Does it also work for methods?  If so, how
>> would it look?
> 
> Here's one way:
> 
> -- foo1.rb --
> class Foo
>   def method1
>   end
> end
> 
> -- foo2.rb --
> class Foo
>   def method2
>   end
> end
> 
> -- foo.rb --
> require 'foo1'
> require 'foo2'
> 
> But you don't see this very often, because it's unusual to have a single
> class containing hundreds of methods. Normally the problem partitions
> better into smaller classes.

The only thing to be aware of when defining parts of a class in different 
files is that only one file can declare the class's ancestor, and that 
has to be the first one loaded.

-- 
Chanoch (Ken) Bloom. PhD candidate. Linguistic Cognition Laboratory.
Department of Computer Science. Illinois Institute of Technology.
http://www.iit.edu/~kbloom1/