Sounds like a good idea to me. I'd like to suggest my codebuilder gem for code generation. It's based on John's previous RubyCLR, and takes inspiration from the xmlbuilder in Rails, for building .NET classes. For example, running the little script below:
<br><br><div style="margin-left: 40px;">require 'rubygems'<br>require 'codebuilder'<br><br>@not_implemented = { "RubyString" => ["public_methods"],<br> "RubyInteger" => ["ancestors"]}
<br><br>result = CodeDOM::Builder.new.build do |builder|<br> builder.namespace "IronRuby" do<br> @not_implemented.each do |klass, methods|<br> builder.partial_klass klass do<br> methods.each do |meth|
<br> builder.method meth do # Array of parameters for the method<br> builder.csharp "throw new NotImplementedException();"<br> end<br> end<br> end <br> end<br> end<br>
end<br><br>puts(result.render :csharp)<br></div><br>Gives you C# code like this:<br><br><div style="margin-left: 40px;">namespace IronRuby {<br> using System;<br> using System.Data;<br> using System.Windows.Forms
;<br><br><br> public partial class RubyString {<br><br> public virtual void public_methods() {<br>throw new NotImplementedException();<br> }<br> }<br><br> public partial class RubyInteger {<br><br> public virtual void ancestors() {
<br>throw new NotImplementedException();<br> }<br> }<br>}<br></div><br>The tool is based on the CodeDOM framework in .NET. The script above builds a representation of the classes, methods, properties etc. that are defined and then 'renders' them to a source language (in this case, C#).
<br><br>It's not able to do attributes on methods but I bet I could add that fairly easily. It's also not seen a lot of use (I use for an internal project at work but otherwise I'm not sure if anyone else ever has) but I'd be glad to provide whatever support would be needed.
<br><br>I just uploaded my latest (5.0.10), which probably won't be available via gem for a few hours, but the project itself is hosted at <a href="http://rubyforge.org/projects/codedombuilder">http://rubyforge.org/projects/codedombuilder
</a>.<br><br>Justin<br><br>p.s. Just to re-iterate, this tool is based on C-Ruby and uses the rubyclr project. I fully intend to port it when IronRuby becomes capable enough :)<br><br><br>