You can't compile to an assembly with IronRuby at this point. But you can
reference the ironruby interpreter library and host the ruby engine in your
application to have it execute ruby files.

http://ironruby.net/Documentation/.NET/Hosting

But I don't think that will completely solve your issue though because to
interop with CLR classes their definitions must exist in the CLR so you
would probably have to build some bridges.

the most straightforward way to do that is by defining CLR interfaces and
adding them to IronRuby classes.

public interface IRobot{
   DeathAndDestructionMode ForgetAboutThe3Laws();
}

in Ruby:

require '/path/to/interfaces/assembly'

class EvilBot
   include IRobot

   def forget_about_the_3_laws
      DeathAndDestructionMode.world_domination
   end
end

a consuming C# class could then get an object you created with your hosting
code and still talk to it because of the CLR interface.

If you're after testing then you can use ruby tools like bacon/rspec to test
your C# code. The only thing that will be weird if you're going to use it
this way is that ruby mockers have no clue what to do with CLR objects.  I
created a project that:

a) accepts patches and contributions
b) gives you mocking that knows about the CLR

http://github.com/casualjim/caricature

---
Met vriendelijke groeten - Best regards - Salutations
Ivan Porto Carrero
Blog: http://flanders.co.nz
Google Wave: portocarrero.i...@googlewave.com
Twitter: http://twitter.com/casualjim
Author of IronRuby in Action (http://manning.com/carrero)



On Tue, Dec 22, 2009 at 12:24 PM, Asfand Yar Qazi <ayq...@gmail.com> wrote:

> Hi,
>
> I want to be able to use Ruby code in the Unity3D game engine, which
> embeds GNU Mono 1.2.4 to provide support for various languages (a
> ECMAScript-based language, Boo, and C# - they don't upgrade the
> ancient Mono version to keep compatibility with games designed for
> older versions of Unity3D).
>
> Forgive my use of terminology, I'm new to this .NET/Mono malarky :)
>
> I was told that I can product .NET 2 assemblies, plug them into
> Unity3D, and the classes will be accessible from the other languages.
>
> Will I be able to use IronRuby to create .NET 2 assemblies in this manner?
>
> Sorry for asking here, but the Unity3D people don't seem interested in
> Ruby as much, and I just can't live without coding in BDD style in a
> robust environment.
>
> Thanks.  Regards,
>     Asfand
> _______________________________________________
> Ironruby-core mailing list
> Ironruby-core@rubyforge.org
> http://rubyforge.org/mailman/listinfo/ironruby-core
>
_______________________________________________
Ironruby-core mailing list
Ironruby-core@rubyforge.org
http://rubyforge.org/mailman/listinfo/ironruby-core

Reply via email to