From: Pit Capitain Date: 2006-04-12T16:10:16+09:00 Subject: Re: Class Definition inside a method definition? Bihal schrieb: > Our software has support for round-trip engineering, which means forward > and reverse engineering and code synchronisation. Which means you can > > 1) Import your code and see how it works from a high level > 2) Design your code and generate the source files from the design > 3) Import code or create a design, and synchronise changes forward and > backward. ie. Change the code and the model can be updated, change the > model and the code can be updated. Bihal, forward engineering Ruby code should be no problem, but I doubt that you can reverse engineer arbitrary Ruby code. I see at least the following problems: 1) The Ruby object model is different from that of other OO languages. In Ruby, you can add methods to single objects. I don't think that the meta model of your tool can represent this concept. You would also need to handle Ruby's concept of mixins, which is a kind of multiple inheritance, but with slightly different semantics. 2) Ruby is very dynamic. You can create and alter classes and methods at runtime. The design model of such code could only be determined by actually running the code, and it could be dependent on runtime parameters. 3) You can use method_missing to implement methods "on the fly". A tool has no chance to recognize those methods. Even running the code wouldn't help in this case. Again, it would be nice to have Ruby support in your tool, but there are huge problems way beyond the syntax level. As others have mentioned, I'd strongly suggest learning the Ruby concepts first. Only then, if you still think your tool can handle all this, should you look at the syntax. Regards, Pit