Hi, Is there a table somewhere defining how .Net objects are mapped to Ruby objects? Thanks, Shay ---------------------------- http://www.ironshay.com Follow me: http://twitter.com/ironshay
on 2009-06-08 18:27
on 2009-06-08 18:45
http://ironruby.net/Documentation/.NET/Names http://ironruby.net/Documentation/.NET --- Met vriendelijke groeten - Best regards - Salutations Ivan Porto Carrero Blog: http://flanders.co.nz Twitter: http://twitter.com/casualjim Author of IronRuby in Action (http://manning.com/carrero)
on 2009-06-08 18:51
I meant more like namespaces turn to modules, interfaces to modules, enums to...? constants to...? I'll check it out now and write the results here. Thanks for the reply! Shay. ---------------------------- http://www.ironshay.com Follow me: http://twitter.com/ironshay
on 2009-06-08 19:14
http://ironruby.net/Documentation/.NET/QA_Plan There is a table there that covers most of these. Let me know if you need something that isn't listed. JD ...there is no try
on 2009-06-08 19:57
The list on this page is great but it is not complete. Here is what I came up with. Correct me if I'm mistaken: .Net Object Ruby Object ------------------------------------------------------ Namespace Module Interface Module Class Class Enum Class Enum constant Class method Constant Class method Static method Class method Property Getter and setter methods Public method Instance method Protected method Instance method Private method Isn't mapped at all Delegate Class I have to say that the delegate mapping is awesome!!! I can't say why, but using it with a code block is much more fun than writing anonymous methods or lambda expressions in C# :) Thanks, Shay. ---------------------------- http://www.ironshay.com Follow me: http://twitter.com/ironshay
on 2009-06-08 20:14
Private method will map to a instance method, but only with -X:PrivateBindings. Otherwise that looks great. Could I talk you into updating the table and adding specs to Merlin\Main\Languages\Ruby\Tests\Interop\net? Even just adding them to uncategorized_spec.rb will work, I'll move them around. Thanks, JD ...there is no try
on 2009-06-08 20:18
Sure. Just give me a few days. I'll let you know when it's done. Shay. ---------------------------- http://www.ironshay.com Follow me: http://twitter.com/ironshay
on 2009-06-08 20:55
With a build from the latest sources, the Cucumber C# example from http://wiki.github.com/aslakhellesoy/cucumber/ironruby-and-net is working. Also, only two of the Cucumber tests fail. One seems to be a test issue, and the other is because of http://ironpython.codeplex.com/WorkItem/View.aspx?WorkItemId=22984. Please try out Cucumber and let us know what your experience is. One usability issue is that Cucumber uses the win32console gem to color-code the results it prints to the console, so that failures are in red, etc. However, the win32console is a native gem and does not work with IronRuby, and so you do not get colored output. It should be quite easy to implement the win32console library in pure Ruby code (but marked with platform="ironruby" as mentioned at http://ironruby.net/Documentation/Real_Ruby_Applications/RubyGems) using the System.Console functionality. Anyone interested in doing this? Shri
on 2009-06-09 02:52
2009/6/9 Shri Borde <Shri.Borde@microsoft.com>:
> With a build from the latest sources, the Cucumber C# example from http://wiki.github.com/aslakhellesoy/cucumber/ironruby-and-net is working. Also, only two of the Cucumber tests fail. One seems to be a test issue, and the other is because of http://ironpython.codeplex.com/WorkItem/View.aspx?WorkItemId=22984. Please try out Cucumber and let us know what your experience is.
Why is the issue filed on Iron*Python*?
on 2009-06-09 03:00
That's called dynamic language interop - Dino's fixing bugs in IronRuby :)) I've filled it under IronRuby: http://ironruby.codeplex.com/WorkItem/View.aspx?WorkItemId=1535 Tomas
on 2009-06-09 12:33
By the way, even with "-X:PrivateBinding" I can't access private members. Should it be done in a special way? Thanks, Shay. ---------------------------- http://www.ironshay.com Follow me: http://twitter.com/ironshay
on 2009-06-09 12:35
It also seems like protected methods and internal classes are accessible in IR just like they were public. Is it the correct behavior? Thanks, Shay. ---------------------------- http://www.ironshay.com Follow me: http://twitter.com/ironshay
on 2009-06-09 12:51
My mistake - internal classes are accessible only with -X:PrivateBinding. Protected methods are always accessible like public methods. ---------------------------- http://www.ironshay.com Follow me: http://twitter.com/ironshay
on 2009-06-09 17:30
They are only accessible if called with a receiver that is an instance of a derived class. Or do you observe another behavior? Tomas
on 2009-06-09 17:38
I assumed a reflection like behavior... For example, doing something like: klass.method(:MyPrivateClrMethod).call Can you write a simple example of what you've described? Thanks, Shay. ---------------------------- http://www.ironshay.com Follow me: http://twitter.com/ironshay
on 2009-06-09 18:22
That should work: [302] > rbr IronRuby 0.5.0.0 on .NET 2.0.50727.4918 Copyright (c) Microsoft Corporation. All rights reserved. >>> require 'fixtures.generated' => true >>> c = ClassWithMethods.new => ClassWithMethods >>> c.private_method :0: undefined method `private_method' for ClassWithMethods:ClassWithMethods (NoMethodError) >>> c.private_methods => ["initialize", "`", "abort", "Array", "at_exit", "autoload", "autoload?", "binding", "block_given?", "caller", "catch", "eval", "exec", "exit", "exit!", "fail", "Float", "format", "getc", "gets", "global_variables", "initialize_copy", "Integer", "iterator?", "lambda", "load", "load_assembly", "local_variables", "loop", "method_missing", "open", "p", "print", "printf", "proc", "putc", "puts", "raise", "rand", "remove_instance_variable", "require", "select", "set_trace_func", "singleton_method_added", "singleton_method_removed", "singleton_method_undefined", "sleep", "sprintf", "String", "system", "throw", "trap", "warn"] >>> c.method(:private_method) :0:in `method': undefined method `private_method' for class `ClassWithMethods' (NameError) from :0 >>> exit C:\vsl\Merlin\Main\Languages\Ruby\Tests\Interop\net [303] > rbr "-X:PrivateBinding" IronRuby 0.5.0.0 on .NET 2.0.50727.4918 Copyright (c) Microsoft Corporation. All rights reserved. >>> require 'fixtures.generated' => true >>> c = ClassWithMethods.new => ClassWithMethods >>> c.private_method => 'private' >>> c.private_methods => ["initialize", "`", "abort", "Array", "at_exit", "autoload", "autoload?", "binding", "block_given?", "caller", "catch", "eval", "exec", "exit", "exit!", "fail", "Float", "format", "getc", "gets", "global_variables", "initialize_copy", "Integer", "iterator?", "lambda", "load", "load_assembly", "local_variables", "loop", "method_missing", "open", "p", "print", "printf", "proc", "putc", "puts", "raise", "rand", "remove_instance_variable", "require", "select", "set_trace_func", "singleton_method_added", "singleton_method_removed", "singleton_method_undefined", "sleep", "sprintf", "String", "system", "throw", "trap", "warn"] >>> c.method(:private_method) => #<Method: ClassWithMethods#private_method> >>> c.method(:private_method).call => 'private' >>> c.method(:private_method)[] => 'private' >>> exit C:\vsl\Merlin\Main\Languages\Ruby\Tests\Interop\net [304] > If you want to try with this class, it is defined in the fixtures.generated.dll assembly in Merlin\Main\Languages\Ruby\Tests\Interop\net Thanks, JD ...there is no try
on 2009-06-09 23:05
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
on 2009-06-09 23:44
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
on 2009-06-10 06:25
I had an old version (3-4 week old). After I got the latest source and compiles it really works. Sorry for that. Thanks! Shay.
on 2009-06-14 07:49
I just wrote up a blog post detailing, step by step, the process I followed to get Cucumber working with IronRuby. May be old hat to some of you, but I figured that documenting my process might help others going forward. http://hotgazpacho.org/2009/06/cucumber-and-ironruby-it-runs/
on 2009-06-14 20:46
Thanks for the post! It will be very useful to people wanting to use it. Mind if I put something similar on the “Real Ruby applications and libraries†page? http://ironruby.net/Documentation/Real_Ruby_Applications I have comment about the last section: SUPER IMPORTANT NOTE! Any time you rebuild IronRuby, the C# compiler will erase the contents of the directory C:\Development\IronRuby\Merlin\Main\Bin\Debug. This includes the cucumber and cucumber.bat files. The only way I know to rectify this is to igem install -–no-rdoc -–no-ri cucumber once again. To avoid doing this, just have people create the cucumber.bat/cucumber files in Merlin/Main/Languages/Ruby/Scripts/bin, where all the other files like that are (rails.bat, rake.bat, etc). I believe that directory already copies to a build’s $(TargetDir), but if not you can either just add it to the path or make it copy. ~js From: ironruby-core-bounces@rubyforge.org [mailto:ironruby-core-bounces@rubyforge.org] On Behalf Of Will Green Sent: Saturday, June 13, 2009 10:48 PM To: ironruby-core@rubyforge.org Subject: Re: [Ironruby-core] Cucumber status I just wrote up a blog post detailing, step by step, the process I followed to get Cucumber working with IronRuby. May be old hat to some of you, but I figured that documenting my process might help others going forward. http://hotgazpacho.org/2009/06/cucumber-and-ironruby-it-runs/ -- Will Green http://willgreen.mp/
on 2009-06-14 21:29
My pleasure! I hope others will find the guide helpful. Pleas feel free to link to the post and publicize it any way you see fit. As for the cucumber executables (cucumber & cucumber.bat), or any gem that installs executable commands, these files are installed by the gem command, by default, in the same directory as the ruby executable. Perhaps some combination of setting GEM_HOME and GEM_PATH could allow them to be installed elsewhere? My RubyGems-foo is not yet advanced enough. I would hate for this to be a manual process for every gem install, every time you rebuild IronRuby. I'm open to suggestions on automating this, and ammending the post. -- Will Green http://willgreen.mp/ On Jun 14, 2009, at 2:42 PM, Jimmy Schementi <Jimmy.Schementi@microsoft.com
on 2009-06-20 16:04
Shri, I am very interested in using cucumber for my .Net projects, so I'm willing to give it a go at porting win32console. To that end, I've created a git repo for it on GitHub: http://github.com/hotgazpacho/ironruby-win32console Any guidance anyone can offer would be appreciated. Thanks! -- Will Green http://willgreen.mp/
Please log in before posting. Registration is free and takes only a minute.
Existing account
(Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
Log in with Google account | Log in with Yahoo account
No account? Register here.