Re: [Ironruby-core] call an overloaded constructor??

2009-11-13 Thread Patrick Brown
Hello Thank you all for your help and I have to say that I am sorry also, I missed the other replies where you came right out and told me how to do it, for some reason I only saw the one that mapped the DateTime to the Time object, you all provided very good answers to my question and I really

[Ironruby-core] IronRuby .Net 4 CTP and dynamic

2009-11-13 Thread Patrick Brown
Hi Should I be able to call out to a C# method with this release that returns a dynamic and access it's return value? public class Modifier { public dynamic Modify(IPropertyPolicyInfo info) { dynamic obj = new ExpandoObject(); obj.Name = info.AccountShortName; obj.Address = new Expando

[Ironruby-core] Calling a C# static from IronRuby

2009-11-13 Thread Alexandre Mutel
Hi all, Is there any way to declare a C# static method accessible from IronRuby as a regular Ruby method? like: public class MyCSharpClass { public static string mymethod(string test) { return test + "yes"; } } in ironruby: puts mymethod("test") -- Posted via http://www.ruby-forum.com/. __

Re: [Ironruby-core] Calling a C# static from IronRuby

2009-11-13 Thread Shay Friedman
I guess you can do that in two ways. The first one is to add a statement in Ruby code: class Object def mymethod(str) MyCSharpClass.mymethod(str) end end Or you can write an IronRuby extension in C# and make that class extend the Object class. Shay. --

Re: [Ironruby-core] Calling a C# static from IronRuby

2009-11-13 Thread Ivan Porto Carrero
You can only reach it by adding the class as receiver. but you can use method missing as a dispatcher: alias :old_mm :method_missing def method_missing(method_name, *args, &block) return MyCSharpClass.send(method_name, *args) if MyCSharpClass.respond_to? method_name old_mn method_name, *arg

Re: [Ironruby-core] Calling a C# static from IronRuby

2009-11-13 Thread Jimmy Schementi
FYI, we’re thinking about allowing you to use “include” with .NET types, which will include it’s static methods. That would enable: include MyCSharpClass puts mymethod "foo" IronPython already does this for import, so it seems like a good idea: from MyCSharpClass import mymethod print mymethod(

Re: [Ironruby-core] Calling a C# static from IronRuby

2009-11-13 Thread Ivan Porto Carrero
My 2c on the matter I think Ruby on .NET is great and stuff like the clr_new, overloads etc are a necessary evil to ease working with CLR classes. But I do think that changing a basic construct like include will not be good unless the other rubies also include it. The reason for it is you only use

Re: [Ironruby-core] Calling a C# static from IronRuby

2009-11-13 Thread Alexandre Mutel
Ivan Porto carrero wrote: > You can only reach it by adding the class as receiver. > > but you can use method missing as a dispatcher: > > alias :old_mm :method_missing > def method_missing(method_name, *args, &block) >return MyCSharpClass.send(method_name, *args) if > MyCSharpClass.respond_

Re: [Ironruby-core] Calling a C# static from IronRuby

2009-11-13 Thread Alexandre Mutel
> On a similar subject, is there a way to resolve dynamic variable at > runtime? Like, a user type a variable that was not declared, but the DLR > host is able to create on the fly an object for this variable and return > it. Is it possible? Is "IDynamicMetaObjectProvider" and > "IAttributesCol

Re: [Ironruby-core] Calling a C# static from IronRuby

2009-11-13 Thread Orion Edwards
On Fri, Nov 13, 2009 at 9:07 PM, Jimmy Schementi > wrote: FYI, we’re thinking about allowing you to use “include” with .NET types, which will include it’s static methods. That would enable: I'd be very much in favour of this. A .NET static class full of static methods always seemed like it

[Ironruby-core] Interop with Sql Mgmt Objects (SMO) - the "IronRuby Way"

2009-11-13 Thread Mark Wilkins
Thanks to casualjim in #ironruby, I figured out a way to do what I needed, but would be interested to see if there is a more appropriate solution: I'm trying to use SMO to script objects from a SqlServer DB, using IR. In particular, I am calling Microsoft::SqlServer::Management::Smo::Scripter.Scr

Re: [Ironruby-core] Calling a C# static from IronRuby

2009-11-13 Thread Jimmy Schementi
> From: ironruby-core-boun...@rubyforge.org [mailto:ironruby-core- > boun...@rubyforge.org] On Behalf Of Alexandre Mutel > Sent: Friday, November 13, 2009 1:45 PM > To: ironruby-core@rubyforge.org > Subject: Re: [Ironruby-core] Calling a C# static from IronRuby > > > On a similar subject, is there