On 7/13/06, Eric Armstrong <Eric.Armstrong / sun.com> wrote: > Looking at HTree, I see a few more things > that seem weird to me, but which are > probably perfectly normal Ruby: > > file: parse.rb > -------------- > module HTree > def HTree.parse > ... > def > > def HTree.parse_xml > ... > end > > ... > > def Text.parse_cdata_section(raw_string) > ... > end > > def Comment.parse(raw_string) > ... > end > > end # module > --------------- > > This is all very strange and new to me. > There are a dozen files, each of which adds > to the "HTree" module, and in each module, > methods are added to several classes. > > What makes that a desirable way to structure > things? In the Java world, each class is > in its own file. What are the advantages of > doing things this way, instead? Probably to define the module HTree as the top level namespace. "Text" and "Comment" are pretty common names for classes/modules, so putting them inside an HTree module puts them in their own namespace and keeps everything organized. - Rob -- http://www.robsanheim.com http://www.seekingalpha.com http://www.ajaxian.com