Re: [Ironruby-core] Accessing a Module's Classes from C# with dynamic

2011-02-25 Thread Shay Friedman
. > > > > Tomas > > > > *From:* ironruby-core-boun...@rubyforge.org [mailto: > ironruby-core-boun...@rubyforge.org] *On Behalf Of *Shay Friedman > *Sent:* Thursday, February 24, 2011 10:38 PM > > *To:* ironruby-core@rubyforge.org > *Subject:* Re: [Ironruby-core

Re: [Ironruby-core] Accessing a Module's Classes from C# with dynamic

2011-02-25 Thread Tomas Matousek
o:ironruby-core-boun...@rubyforge.org] On Behalf Of Shay Friedman Sent: Thursday, February 24, 2011 10:38 PM To: ironruby-core@rubyforge.org Subject: Re: [Ironruby-core] Accessing a Module's Classes from C# with dynamic I got it working using a kind of a hack/workaround. I know this is kind of a hack/

Re: [Ironruby-core] Accessing a Module's Classes from C# with dynamic

2011-02-24 Thread Shay Friedman
I got it working using a kind of a hack/workaround. I know this is kind of a hack/workaround, but I managed to do it this way: I added the next code to the end of the ruby file: def hack(s) eval(s) end And then used it from the C# code to get the class object: var engine = Ru

Re: [Ironruby-core] Accessing a Module's Classes from C# with dynamic

2011-02-24 Thread Rob R.
to add directories to your search path from within C# you can do something like this: var engine = Ruby.CreateEngine(); var searchPaths = engine.GetSearchPaths().ToList(); searchPaths.Add(@"c:\code\generator\lib"); searchPaths.Add(@"C:\Ruby-ri-192\lib\ruby\1.9.1"); engine.SetSearchPaths(searchP

Re: [Ironruby-core] Accessing a Module's Classes from C# with dynamic

2011-01-15 Thread Joshua M.
>You need to include the Module if you want to >access the class without qualifying it. I have tried this but it doesn't work (RuntimeBinderException: 'Microsoft.Scripting.Hosting.ScriptScope' does not contain a definition for 'Foo'). In my original post I had specified the fully qualified name.

Re: [Ironruby-core] Accessing a Module's Classes from C# with dynamic

2011-01-15 Thread Tomas Matousek
o:ironruby-core-boun...@rubyforge.org] On Behalf Of Joshua M. Sent: Friday, January 14, 2011 11:55 PM To: ironruby-core@rubyforge.org Subject: Re: [Ironruby-core] Accessing a Module's Classes from C# with dynamic It turns out that the problem is not accessing a module's class, but accessin

Re: [Ironruby-core] Accessing a Module's Classes from C# with dynamic

2011-01-15 Thread Will Green
On Jan 15, 2011, at 2:55 AM, Joshua M. wrote: > No matter what I do I can only access RbScriptApp and not Foo if I call > Runtime.UseFile("global.rb"). So far I have two other work arounds: 1.) > create wrapper methods for everything I want to access in app.rb (ugh), > or 2.) use Engine.Execute("R

Re: [Ironruby-core] Accessing a Module's Classes from C# with dynamic

2011-01-15 Thread Joshua M.
It turns out that the problem is not accessing a module's class, but accessing the contents of a module in a require'd file. global.rb require 'app' app.rb module RbScriptApp class Foo def Bar() return (rand(100) + 1).to_s() end end end No matt