[Ironruby-core] .Net<->IR Object Mapping

Jim Deville jdeville at microsoft.com
Tue Jun 9 17:35:02 EDT 2009


Works just fine for me. How are you starting up the console? Here's my method:
[201] > ir -X:PrivateBinding
IronRuby 0.5.0.0 on .NET 2.0.50727.4918
Copyright (c) Microsoft Corporation. All rights reserved.

>>> require 'temp1'
=> true
>>> IRTests::IRTest.new.my_method
Hi from C#
=> nil
>>>

JD

...there is no try


> -----Original Message-----
> From: ironruby-core-bounces at rubyforge.org [mailto:ironruby-core-
> bounces at rubyforge.org] On Behalf Of Shay Friedman
> Sent: Tuesday, June 09, 2009 2:05 PM
> To: ironruby-core at rubyforge.org
> Subject: Re: [Ironruby-core] .Net<->IR Object Mapping
>
> I can't get it to work... What am I doing wrong?
>
> This is my C# code:
> namespace IRTests
> {
>   public class IRTest
>   {
>     private void MyMethod() {
>       Console.WriteLine("Hi from C#");
>     }
>   }
> }
>
> And this is the IR console:
>
> >>> t = IRTests::IRTest.new
> => IRTests.IRTest
> >>> t.my_method
> :0: undefined method `my_method' for IRTests.IRTest:IRTests::IRTest
> (NoMethodError)
>
> >>> t.method(:my_method)
> D:\IronRuby\GitRepository\ironruby\Merlin\Main\Languages\Ruby\Libraries
> .LCA_RESTRICTED\Builtins\KernelOps.cs:1437:in
> `method': undefined method `my_method' for class `IRTests::IRTest'
> (NameError)        from :0
>
> Thanks!
> Shay.
> ----------------------------
> Shay Friedman
> http://www.ironshay.com
> Follow me: http://twitter.com/ironshay
> --
> Posted via http://www.ruby-forum.com/.
> _______________________________________________
> Ironruby-core mailing list
> Ironruby-core at rubyforge.org
> http://rubyforge.org/mailman/listinfo/ironruby-core



More information about the Ironruby-core mailing list