[Ironruby-core] How to implement a C# interface from Ruby ?

Tomas Matousek Tomas.Matousek at microsoft.com
Mon Feb 9 20:41:51 EST 2009

Have you tried "def HelloWorld; end" (ie. match the interface method casing)?


From: ironruby-core-bounces at rubyforge.org [mailto:ironruby-core-bounces at rubyforge.org] On Behalf Of Thibaut Barrère
Sent: Monday, February 09, 2009 5:23 PM
To: ironruby-core
Subject: [Ironruby-core] How to implement a C# interface from Ruby ?

Hello again,

I'm playing around with the idea of using IronRuby to implement plugins for a C#-based system (namely, CruiseControl.Net).

I'm having some difficulties trying to figure out what the correct syntax for that would be. I'm currently using this to bootstrap the engine:

                                    var reader = new StreamReader("plugin.rb");
                                    var code = reader.ReadToEnd();

                                    var engine = IronRuby.Ruby.CreateEngine();

The code inside plugin.rb is trying to implement an existing C# interface:

            public interface IDoSomething {
                        void HelloWorld();

I tried:

class Doer
  include IDoSomething

  def hello_world
    puts "hello"

but it fails. What would be the correct syntax for a Ruby class to implement this ?


-- Thibaut
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://rubyforge.org/pipermail/ironruby-core/attachments/20090209/65755b6b/attachment-0001.html>

More information about the Ironruby-core mailing list