Dear users, I want to build a testscript scheduler / executer in C# that runs several Ruby scripts in sequence. For this I use IronRuby with the following constuction: ScriptRuntime runtime = Ruby.CreateRuntime(); ScriptEngine engine = runtime.GetEngine("rb"); loop through scripts: engine.ExecuteFile("script.rb"); This works fine for basic scripts. However some scripts have class definition that inherite from a base class. When such a script (class < baseclass) is passed in: engine.ExecuteFile("script.rb"); The following exception is thrown: Microsoft.Dynamic uninitialized constant Object::BaseClass I can not find a solution for this problem, so any suggestion is welcome. If I need an other approuch, do hesitate to say so. Still learning about Ruby integration in .NET Thanks in advance -- Posted via http://www.ruby-forum.com/.
you have to require the other files it uses too in the same engine. or you can add the paths to where the scripts can be found to the $LOAD_PATHS ($:) variable. require a file: http://github.com/casualjim/ironrubymvc/blob/master/IronRubyMvc/Core/RubyEngine.cs#L279 add load paths http://github.com/casualjim/ironrubymvc/blob/master/IronRubyMvc/Core/RubyEngine.cs#L346 --- 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 Wed, Sep 30, 2009 at 3:17 PM, Eelco Henderichs <lists at ruby-forum.com>wrote:> Dear users, > > I want to build a testscript scheduler / executer in C# that runs > several Ruby scripts in sequence. > > For this I use IronRuby with the following constuction: > > ScriptRuntime runtime = Ruby.CreateRuntime(); > ScriptEngine engine = runtime.GetEngine("rb"); > > loop through scripts: > engine.ExecuteFile("script.rb"); > > This works fine for basic scripts. However some scripts have class > definition that inherite from a base class. > When such a script (class < baseclass) is passed in: > engine.ExecuteFile("script.rb"); > > The following exception is thrown: > Microsoft.Dynamic > uninitialized constant Object::BaseClass > > I can not find a solution for this problem, so any suggestion is > welcome. If I need an other approuch, do hesitate to say so. Still > learning about Ruby integration in .NET > > Thanks in advance > -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > Ironruby-core mailing list > Ironruby-core at rubyforge.org > http://rubyforge.org/mailman/listinfo/ironruby-core >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/ironruby-core/attachments/20090930/4628c50e/attachment.html>
Thanks! The require a file (containing the base) option works. But adding the path to the file containing the base class does not. Here C# reports an error that the file can not be found. Don''t what''s wrong here, but for know the require a file option will do the trick. -- Posted via http://www.ruby-forum.com/.
root |_ lib |_ great_class.rb |_ test |_ test_great_class.rb let''s say I add root to my load path then I can reach the files in lib with require ''lib/great_class'' or in test_great_class.rb you can do require File.dirname(__FILE__) + "/../lib/great_class" you are free to add the extension in case you''re using require. --- 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 Wed, Sep 30, 2009 at 4:23 PM, Eelco Henderichs <lists at ruby-forum.com>wrote:> Thanks! The require a file (containing the base) option works. > > But adding the path to the file containing the base class does not. Here > C# reports an error that the file can not be found. Don''t what''s wrong > here, but for know the require a file option will do the trick. > -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > Ironruby-core mailing list > Ironruby-core at rubyforge.org > http://rubyforge.org/mailman/listinfo/ironruby-core >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/ironruby-core/attachments/20090930/4a23aa5c/attachment.html>
Agreed. We found if we changed the definition of class C, unless we did something like ''load'', it would continue to use the old definition from the first load. -- Chuck -- Chuck Durfee Lead Software Architect, CentreSuite TSYS iSolutions, Golden Email cdurfee at tsys.com Tomas Matousek <Tomas.Matousek at microsoft.com> Sent by: ironruby-core-bounces at rubyforge.org 09/30/2009 10:27 AM Please respond to ironruby-core at rubyforge.org To "ironruby-core at rubyforge.org" <ironruby-core at rubyforge.org> cc Subject Re: [Ironruby-core] calling ruby scripts from C# If the base class is defined in file ?foo.rb? and used in file ?bar.rb? this should also work: engine.ExecuteFile(?foo.rb?); engine.ExecuteFile(?bar.rb?); Example: C:\Temp>type foo.rb class C end C:\Temp>type bar.rb class D < C end p D.ancestors C:\Temp>rbd IronRuby 0.9.1.0 on .NET 2.0.50727.4918 Copyright (c) Microsoft Corporation. All rights reserved.>>> engine = IronRuby.create_engine=> Microsoft.Scripting.Hosting.ScriptEngine>>> engine.execute_file("foo.rb")=> Microsoft.Scripting.Hosting.ScriptScope>>> engine.execute_file("bar.rb")[D, C, Object, Kernel] => Microsoft.Scripting.Hosting.ScriptScope Tomas From: ironruby-core-bounces at rubyforge.org [mailto:ironruby-core-bounces at rubyforge.org] On Behalf Of CDurfee at tsys.com Sent: Wednesday, September 30, 2009 8:58 AM To: ironruby-core at rubyforge.org Subject: Re: [Ironruby-core] calling ruby scripts from C# In our application, we also found we found ''load'' useful in some circumstances to force reloading of script files, since ''require'' will not reload files it knows it''s already loaded. -- Chuck -- Chuck Durfee Lead Software Architect, CentreSuite TSYS iSolutions, Golden Email cdurfee at tsys.com Ivan Porto Carrero <ivan at flanders.co.nz> Sent by: ironruby-core-bounces at rubyforge.org 09/30/2009 09:41 AM Please respond to ironruby-core at rubyforge.org To ironruby-core at rubyforge.org cc Subject Re: [Ironruby-core] calling ruby scripts from C# root |_ lib |_ great_class.rb |_ test |_ test_great_class.rb let''s say I add root to my load path then I can reach the files in lib with require ''lib/great_class'' or in test_great_class.rb you can do require File.dirname(__FILE__) + "/../lib/great_class" you are free to add the extension in case you''re using require. --- 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 Wed, Sep 30, 2009 at 4:23 PM, Eelco Henderichs <lists at ruby-forum.com> wrote: Thanks! The require a file (containing the base) option works. But adding the path to the file containing the base class does not. Here C# reports an error that the file can not be found. Don''t what''s wrong here, but for know the require a file option will do the trick. -- Posted via http://www.ruby-forum.com/. _______________________________________________ Ironruby-core mailing list Ironruby-core at rubyforge.org http://rubyforge.org/mailman/listinfo/ironruby-core _______________________________________________ Ironruby-core mailing list Ironruby-core at rubyforge.org http://rubyforge.org/mailman/listinfo/ironruby-core The information contained in this communication (including any attachments hereto) is confidential and is intended solely for the personal and confidential use of the individual or entity to whom it is addressed. If the reader of this message is not the intended recipient or an agent responsible for delivering it to the intended recipient, you are hereby notified that you have received this communication in error and that any review, dissemination, copying, or unauthorized use of this information, or the taking of any action in reliance on the contents of this information is strictly prohibited. If you have received this communication in error, please notify us immediately by e-mail, and delete the original message. Thank you _______________________________________________ Ironruby-core mailing list Ironruby-core at rubyforge.org http://rubyforge.org/mailman/listinfo/ironruby-core ----------------------------------------- The information contained in this communication (including any attachments hereto) is confidential and is intended solely for the personal and confidential use of the individual or entity to whom it is addressed. If the reader of this message is not the intended recipient or an agent responsible for delivering it to the intended recipient, you are hereby notified that you have received this communication in error and that any review, dissemination, copying, or unauthorized use of this information, or the taking of any action in reliance on the contents of this information is strictly prohibited. If you have received this communication in error, please notify us immediately by e-mail, and delete the original message. Thank you -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/ironruby-core/attachments/20090930/4dce8e4e/attachment.html>
Makes sense, that?s standard Ruby for you. JD From: ironruby-core-bounces at rubyforge.org [mailto:ironruby-core-bounces at rubyforge.org] On Behalf Of CDurfee at tsys.com Sent: Wednesday, September 30, 2009 10:30 AM To: ironruby-core at rubyforge.org Cc: ironruby-core at rubyforge.org; ironruby-core-bounces at rubyforge.org Subject: Re: [Ironruby-core] calling ruby scripts from C# Agreed. We found if we changed the definition of class C, unless we did something like ''load'', it would continue to use the old definition from the first load. -- Chuck -- Chuck Durfee Lead Software Architect, CentreSuite TSYS iSolutions, Golden Email cdurfee at tsys.com<mailto:cdurfee at tsys.com> Tomas Matousek <Tomas.Matousek at microsoft.com<mailto:Tomas.Matousek at microsoft.com>> Sent by: ironruby-core-bounces at rubyforge.org<mailto:ironruby-core-bounces at rubyforge.org> 09/30/2009 10:27 AM Please respond to ironruby-core at rubyforge.org<mailto:ironruby-core at rubyforge.org> To "ironruby-core at rubyforge.org<mailto:ironruby-core at rubyforge.org>" <ironruby-core at rubyforge.org<mailto:ironruby-core at rubyforge.org>> cc Subject Re: [Ironruby-core] calling ruby scripts from C# If the base class is defined in file ?foo.rb? and used in file ?bar.rb? this should also work: engine.ExecuteFile(?foo.rb?); engine.ExecuteFile(?bar.rb?); Example: C:\Temp>type foo.rb class C end C:\Temp>type bar.rb class D < C end p D.ancestors C:\Temp>rbd IronRuby 0.9.1.0 on .NET 2.0.50727.4918 Copyright (c) Microsoft Corporation. All rights reserved.>>> engine = IronRuby.create_engine=> Microsoft.Scripting.Hosting.ScriptEngine>>> engine.execute_file("foo.rb")=> Microsoft.Scripting.Hosting.ScriptScope>>> engine.execute_file("bar.rb")[D, C, Object, Kernel] => Microsoft.Scripting.Hosting.ScriptScope Tomas From: ironruby-core-bounces at rubyforge.org<mailto:ironruby-core-bounces at rubyforge.org> [mailto:ironruby-core-bounces at rubyforge.org]<mailto:[mailto:ironruby-core-bounces at rubyforge.org]> On Behalf Of CDurfee at tsys.com<mailto:CDurfee at tsys.com> Sent: Wednesday, September 30, 2009 8:58 AM To: ironruby-core at rubyforge.org<mailto:ironruby-core at rubyforge.org> Subject: Re: [Ironruby-core] calling ruby scripts from C# In our application, we also found we found ''load'' useful in some circumstances to force reloading of script files, since ''require'' will not reload files it knows it''s already loaded. -- Chuck -- Chuck Durfee Lead Software Architect, CentreSuite TSYS iSolutions, Golden Email cdurfee at tsys.com<mailto:cdurfee at tsys.com> Ivan Porto Carrero <ivan at flanders.co.nz<mailto:ivan at flanders.co.nz>> Sent by: ironruby-core-bounces at rubyforge.org<mailto:ironruby-core-bounces at rubyforge.org> 09/30/2009 09:41 AM Please respond to ironruby-core at rubyforge.org<mailto:ironruby-core at rubyforge.org> To ironruby-core at rubyforge.org<mailto:ironruby-core at rubyforge.org> cc Subject Re: [Ironruby-core] calling ruby scripts from C# root |_ lib |_ great_class.rb |_ test |_ test_great_class.rb let''s say I add root to my load path then I can reach the files in lib with require ''lib/great_class'' or in test_great_class.rb you can do require File.dirname(__FILE__) + "/../lib/great_class" you are free to add the extension in case you''re using require. --- Met vriendelijke groeten - Best regards - Salutations Ivan Porto Carrero Blog: http://flanders.co.nz<http://flanders.co.nz/> Twitter: http://twitter.com/casualjim Author of IronRuby in Action (http://manning.com/carrero) On Wed, Sep 30, 2009 at 4:23 PM, Eelco Henderichs <lists at ruby-forum.com<mailto:lists at ruby-forum.com>> wrote: Thanks! The require a file (containing the base) option works. But adding the path to the file containing the base class does not. Here C# reports an error that the file can not be found. Don''t what''s wrong here, but for know the require a file option will do the trick. -- Posted via http://www.ruby-forum.com/. _______________________________________________ Ironruby-core mailing list Ironruby-core at rubyforge.org<mailto:Ironruby-core at rubyforge.org> http://rubyforge.org/mailman/listinfo/ironruby-core _______________________________________________ Ironruby-core mailing list Ironruby-core at rubyforge.org<mailto:Ironruby-core at rubyforge.org> http://rubyforge.org/mailman/listinfo/ironruby-core ________________________________ The information contained in this communication (including any attachments hereto) is confidential and is intended solely for the personal and confidential use of the individual or entity to whom it is addressed. If the reader of this message is not the intended recipient or an agent responsible for delivering it to the intended recipient, you are hereby notified that you have received this communication in error and that any review, dissemination, copying, or unauthorized use of this information, or the taking of any action in reliance on the contents of this information is strictly prohibited. If you have received this communication in error, please notify us immediately by e-mail, and delete the original message. Thank you _______________________________________________ Ironruby-core mailing list Ironruby-core at rubyforge.org<mailto:Ironruby-core at rubyforge.org> http://rubyforge.org/mailman/listinfo/ironruby-core ________________________________ The information contained in this communication (including any attachments hereto) is confidential and is intended solely for the personal and confidential use of the individual or entity to whom it is addressed. If the reader of this message is not the intended recipient or an agent responsible for delivering it to the intended recipient, you are hereby notified that you have received this communication in error and that any review, dissemination, copying, or unauthorized use of this information, or the taking of any action in reliance on the contents of this information is strictly prohibited. If you have received this communication in error, please notify us immediately by e-mail, and delete the original message. Thank you -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/ironruby-core/attachments/20090930/8bd9b6cc/attachment.html>
Kernel#load is very similar to ExecuteFile, so you can use either for bringing the definition up to date. Tomas From: ironruby-core-bounces at rubyforge.org [mailto:ironruby-core-bounces at rubyforge.org] On Behalf Of Jim Deville Sent: Wednesday, September 30, 2009 10:35 AM To: ironruby-core at rubyforge.org Cc: ironruby-core-bounces at rubyforge.org Subject: Re: [Ironruby-core] calling ruby scripts from C# Makes sense, that?s standard Ruby for you. JD From: ironruby-core-bounces at rubyforge.org [mailto:ironruby-core-bounces at rubyforge.org] On Behalf Of CDurfee at tsys.com Sent: Wednesday, September 30, 2009 10:30 AM To: ironruby-core at rubyforge.org Cc: ironruby-core at rubyforge.org; ironruby-core-bounces at rubyforge.org Subject: Re: [Ironruby-core] calling ruby scripts from C# Agreed. We found if we changed the definition of class C, unless we did something like ''load'', it would continue to use the old definition from the first load. -- Chuck -- Chuck Durfee Lead Software Architect, CentreSuite TSYS iSolutions, Golden Email cdurfee at tsys.com<mailto:cdurfee at tsys.com> Tomas Matousek <Tomas.Matousek at microsoft.com<mailto:Tomas.Matousek at microsoft.com>> Sent by: ironruby-core-bounces at rubyforge.org<mailto:ironruby-core-bounces at rubyforge.org> 09/30/2009 10:27 AM Please respond to ironruby-core at rubyforge.org<mailto:ironruby-core at rubyforge.org> To "ironruby-core at rubyforge.org<mailto:ironruby-core at rubyforge.org>" <ironruby-core at rubyforge.org<mailto:ironruby-core at rubyforge.org>> cc Subject Re: [Ironruby-core] calling ruby scripts from C# If the base class is defined in file ?foo.rb? and used in file ?bar.rb? this should also work: engine.ExecuteFile(?foo.rb?); engine.ExecuteFile(?bar.rb?); Example: C:\Temp>type foo.rb class C end C:\Temp>type bar.rb class D < C end p D.ancestors C:\Temp>rbd IronRuby 0.9.1.0 on .NET 2.0.50727.4918 Copyright (c) Microsoft Corporation. All rights reserved.>>> engine = IronRuby.create_engine=> Microsoft.Scripting.Hosting.ScriptEngine>>> engine.execute_file("foo.rb")=> Microsoft.Scripting.Hosting.ScriptScope>>> engine.execute_file("bar.rb")[D, C, Object, Kernel] => Microsoft.Scripting.Hosting.ScriptScope Tomas From: ironruby-core-bounces at rubyforge.org<mailto:ironruby-core-bounces at rubyforge.org> [mailto:ironruby-core-bounces at rubyforge.org]<mailto:[mailto:ironruby-core-bounces at rubyforge.org]> On Behalf Of CDurfee at tsys.com<mailto:CDurfee at tsys.com> Sent: Wednesday, September 30, 2009 8:58 AM To: ironruby-core at rubyforge.org<mailto:ironruby-core at rubyforge.org> Subject: Re: [Ironruby-core] calling ruby scripts from C# In our application, we also found we found ''load'' useful in some circumstances to force reloading of script files, since ''require'' will not reload files it knows it''s already loaded. -- Chuck -- Chuck Durfee Lead Software Architect, CentreSuite TSYS iSolutions, Golden Email cdurfee at tsys.com<mailto:cdurfee at tsys.com> Ivan Porto Carrero <ivan at flanders.co.nz<mailto:ivan at flanders.co.nz>> Sent by: ironruby-core-bounces at rubyforge.org<mailto:ironruby-core-bounces at rubyforge.org> 09/30/2009 09:41 AM Please respond to ironruby-core at rubyforge.org<mailto:ironruby-core at rubyforge.org> To ironruby-core at rubyforge.org<mailto:ironruby-core at rubyforge.org> cc Subject Re: [Ironruby-core] calling ruby scripts from C# root |_ lib |_ great_class.rb |_ test |_ test_great_class.rb let''s say I add root to my load path then I can reach the files in lib with require ''lib/great_class'' or in test_great_class.rb you can do require File.dirname(__FILE__) + "/../lib/great_class" you are free to add the extension in case you''re using require. --- Met vriendelijke groeten - Best regards - Salutations Ivan Porto Carrero Blog: http://flanders.co.nz<http://flanders.co.nz/> Twitter: http://twitter.com/casualjim Author of IronRuby in Action (http://manning.com/carrero) On Wed, Sep 30, 2009 at 4:23 PM, Eelco Henderichs <lists at ruby-forum.com<mailto:lists at ruby-forum.com>> wrote: Thanks! The require a file (containing the base) option works. But adding the path to the file containing the base class does not. Here C# reports an error that the file can not be found. Don''t what''s wrong here, but for know the require a file option will do the trick. -- Posted via http://www.ruby-forum.com/. _______________________________________________ Ironruby-core mailing list Ironruby-core at rubyforge.org<mailto:Ironruby-core at rubyforge.org> http://rubyforge.org/mailman/listinfo/ironruby-core _______________________________________________ Ironruby-core mailing list Ironruby-core at rubyforge.org<mailto:Ironruby-core at rubyforge.org> http://rubyforge.org/mailman/listinfo/ironruby-core ________________________________ The information contained in this communication (including any attachments hereto) is confidential and is intended solely for the personal and confidential use of the individual or entity to whom it is addressed. If the reader of this message is not the intended recipient or an agent responsible for delivering it to the intended recipient, you are hereby notified that you have received this communication in error and that any review, dissemination, copying, or unauthorized use of this information, or the taking of any action in reliance on the contents of this information is strictly prohibited. If you have received this communication in error, please notify us immediately by e-mail, and delete the original message. Thank you _______________________________________________ Ironruby-core mailing list Ironruby-core at rubyforge.org<mailto:Ironruby-core at rubyforge.org> http://rubyforge.org/mailman/listinfo/ironruby-core ________________________________ The information contained in this communication (including any attachments hereto) is confidential and is intended solely for the personal and confidential use of the individual or entity to whom it is addressed. If the reader of this message is not the intended recipient or an agent responsible for delivering it to the intended recipient, you are hereby notified that you have received this communication in error and that any review, dissemination, copying, or unauthorized use of this information, or the taking of any action in reliance on the contents of this information is strictly prohibited. If you have received this communication in error, please notify us immediately by e-mail, and delete the original message. Thank you -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/ironruby-core/attachments/20090930/e98cbb54/attachment.html>
Indeed. We came to Ruby from C#, so it wasn''t immediately obvious to us. Thanks! -- Chuck -- Chuck Durfee Lead Software Architect, CentreSuite TSYS iSolutions, Golden Email cdurfee at tsys.com Jim Deville <jdeville at microsoft.com> Sent by: ironruby-core-bounces at rubyforge.org 09/30/2009 11:38 AM Please respond to ironruby-core at rubyforge.org To "ironruby-core at rubyforge.org" <ironruby-core at rubyforge.org> cc "ironruby-core-bounces at rubyforge.org" <ironruby-core-bounces at rubyforge.org> Subject Re: [Ironruby-core] calling ruby scripts from C# Makes sense, that?s standard Ruby for you. JD From: ironruby-core-bounces at rubyforge.org [mailto:ironruby-core-bounces at rubyforge.org] On Behalf Of CDurfee at tsys.com Sent: Wednesday, September 30, 2009 10:30 AM To: ironruby-core at rubyforge.org Cc: ironruby-core at rubyforge.org; ironruby-core-bounces at rubyforge.org Subject: Re: [Ironruby-core] calling ruby scripts from C# Agreed. We found if we changed the definition of class C, unless we did something like ''load'', it would continue to use the old definition from the first load. -- Chuck -- Chuck Durfee Lead Software Architect, CentreSuite TSYS iSolutions, Golden Email cdurfee at tsys.com Tomas Matousek <Tomas.Matousek at microsoft.com> Sent by: ironruby-core-bounces at rubyforge.org 09/30/2009 10:27 AM Please respond to ironruby-core at rubyforge.org To "ironruby-core at rubyforge.org" <ironruby-core at rubyforge.org> cc Subject Re: [Ironruby-core] calling ruby scripts from C# If the base class is defined in file ?foo.rb? and used in file ?bar.rb? this should also work: engine.ExecuteFile(?foo.rb?); engine.ExecuteFile(?bar.rb?); Example: C:\Temp>type foo.rb class C end C:\Temp>type bar.rb class D < C end p D.ancestors C:\Temp>rbd IronRuby 0.9.1.0 on .NET 2.0.50727.4918 Copyright (c) Microsoft Corporation. All rights reserved.>>> engine = IronRuby.create_engine=> Microsoft.Scripting.Hosting.ScriptEngine>>> engine.execute_file("foo.rb")=> Microsoft.Scripting.Hosting.ScriptScope>>> engine.execute_file("bar.rb")[D, C, Object, Kernel] => Microsoft.Scripting.Hosting.ScriptScope Tomas From: ironruby-core-bounces at rubyforge.org [mailto:ironruby-core-bounces at rubyforge.org] On Behalf Of CDurfee at tsys.com Sent: Wednesday, September 30, 2009 8:58 AM To: ironruby-core at rubyforge.org Subject: Re: [Ironruby-core] calling ruby scripts from C# In our application, we also found we found ''load'' useful in some circumstances to force reloading of script files, since ''require'' will not reload files it knows it''s already loaded. -- Chuck -- Chuck Durfee Lead Software Architect, CentreSuite TSYS iSolutions, Golden Email cdurfee at tsys.com Ivan Porto Carrero <ivan at flanders.co.nz> Sent by: ironruby-core-bounces at rubyforge.org 09/30/2009 09:41 AM Please respond to ironruby-core at rubyforge.org To ironruby-core at rubyforge.org cc Subject Re: [Ironruby-core] calling ruby scripts from C# root |_ lib |_ great_class.rb |_ test |_ test_great_class.rb let''s say I add root to my load path then I can reach the files in lib with require ''lib/great_class'' or in test_great_class.rb you can do require File.dirname(__FILE__) + "/../lib/great_class" you are free to add the extension in case you''re using require. --- 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 Wed, Sep 30, 2009 at 4:23 PM, Eelco Henderichs <lists at ruby-forum.com> wrote: Thanks! The require a file (containing the base) option works. But adding the path to the file containing the base class does not. Here C# reports an error that the file can not be found. Don''t what''s wrong here, but for know the require a file option will do the trick. -- Posted via http://www.ruby-forum.com/. _______________________________________________ Ironruby-core mailing list Ironruby-core at rubyforge.org http://rubyforge.org/mailman/listinfo/ironruby-core _______________________________________________ Ironruby-core mailing list Ironruby-core at rubyforge.org http://rubyforge.org/mailman/listinfo/ironruby-core The information contained in this communication (including any attachments hereto) is confidential and is intended solely for the personal and confidential use of the individual or entity to whom it is addressed. If the reader of this message is not the intended recipient or an agent responsible for delivering it to the intended recipient, you are hereby notified that you have received this communication in error and that any review, dissemination, copying, or unauthorized use of this information, or the taking of any action in reliance on the contents of this information is strictly prohibited. If you have received this communication in error, please notify us immediately by e-mail, and delete the original message. Thank you _______________________________________________ Ironruby-core mailing list Ironruby-core at rubyforge.org http://rubyforge.org/mailman/listinfo/ironruby-core The information contained in this communication (including any attachments hereto) is confidential and is intended solely for the personal and confidential use of the individual or entity to whom it is addressed. If the reader of this message is not the intended recipient or an agent responsible for delivering it to the intended recipient, you are hereby notified that you have received this communication in error and that any review, dissemination, copying, or unauthorized use of this information, or the taking of any action in reliance on the contents of this information is strictly prohibited. If you have received this communication in error, please notify us immediately by e-mail, and delete the original message. Thank you _______________________________________________ Ironruby-core mailing list Ironruby-core at rubyforge.org http://rubyforge.org/mailman/listinfo/ironruby-core ----------------------------------------- The information contained in this communication (including any attachments hereto) is confidential and is intended solely for the personal and confidential use of the individual or entity to whom it is addressed. If the reader of this message is not the intended recipient or an agent responsible for delivering it to the intended recipient, you are hereby notified that you have received this communication in error and that any review, dissemination, copying, or unauthorized use of this information, or the taking of any action in reliance on the contents of this information is strictly prohibited. If you have received this communication in error, please notify us immediately by e-mail, and delete the original message. Thank you -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/ironruby-core/attachments/20090930/547bcab7/attachment.html>
Apologies if my earlier answer was rude. I wasn?t trying to be rude, and looking at it I realize it could be taken as such. I know I appreciate hearing that people are using IronRuby on real projects, not just as a novelty language ? Thanks, JD From: ironruby-core-bounces at rubyforge.org [mailto:ironruby-core-bounces at rubyforge.org] On Behalf Of CDurfee at tsys.com Sent: Wednesday, September 30, 2009 11:32 AM To: ironruby-core at rubyforge.org Cc: ironruby-core at rubyforge.org; ironruby-core-bounces at rubyforge.org Subject: Re: [Ironruby-core] calling ruby scripts from C# Indeed. We came to Ruby from C#, so it wasn''t immediately obvious to us. Thanks! -- Chuck -- Chuck Durfee Lead Software Architect, CentreSuite TSYS iSolutions, Golden Email cdurfee at tsys.com<mailto:cdurfee at tsys.com> Jim Deville <jdeville at microsoft.com<mailto:jdeville at microsoft.com>> Sent by: ironruby-core-bounces at rubyforge.org<mailto:ironruby-core-bounces at rubyforge.org> 09/30/2009 11:38 AM Please respond to ironruby-core at rubyforge.org<mailto:ironruby-core at rubyforge.org> To "ironruby-core at rubyforge.org<mailto:ironruby-core at rubyforge.org>" <ironruby-core at rubyforge.org<mailto:ironruby-core at rubyforge.org>> cc "ironruby-core-bounces at rubyforge.org<mailto:ironruby-core-bounces at rubyforge.org>" <ironruby-core-bounces at rubyforge.org<mailto:ironruby-core-bounces at rubyforge.org>> Subject Re: [Ironruby-core] calling ruby scripts from C# Makes sense, that?s standard Ruby for you. JD From: ironruby-core-bounces at rubyforge.org<mailto:ironruby-core-bounces at rubyforge.org> [mailto:ironruby-core-bounces at rubyforge.org]<mailto:[mailto:ironruby-core-bounces at rubyforge.org]> On Behalf Of CDurfee at tsys.com<mailto:CDurfee at tsys.com> Sent: Wednesday, September 30, 2009 10:30 AM To: ironruby-core at rubyforge.org<mailto:ironruby-core at rubyforge.org> Cc: ironruby-core at rubyforge.org<mailto:ironruby-core at rubyforge.org>; ironruby-core-bounces at rubyforge.org<mailto:ironruby-core-bounces at rubyforge.org> Subject: Re: [Ironruby-core] calling ruby scripts from C# Agreed. We found if we changed the definition of class C, unless we did something like ''load'', it would continue to use the old definition from the first load. -- Chuck -- Chuck Durfee Lead Software Architect, CentreSuite TSYS iSolutions, Golden Email cdurfee at tsys.com<mailto:cdurfee at tsys.com> Tomas Matousek <Tomas.Matousek at microsoft.com<mailto:Tomas.Matousek at microsoft.com>> Sent by: ironruby-core-bounces at rubyforge.org<mailto:ironruby-core-bounces at rubyforge.org> 09/30/2009 10:27 AM Please respond to ironruby-core at rubyforge.org<mailto:ironruby-core at rubyforge.org> To "ironruby-core at rubyforge.org<mailto:ironruby-core at rubyforge.org>" <ironruby-core at rubyforge.org<mailto:ironruby-core at rubyforge.org>> cc Subject Re: [Ironruby-core] calling ruby scripts from C# If the base class is defined in file ?foo.rb? and used in file ?bar.rb? this should also work: engine.ExecuteFile(?foo.rb?); engine.ExecuteFile(?bar.rb?); Example: C:\Temp>type foo.rb class C end C:\Temp>type bar.rb class D < C end p D.ancestors C:\Temp>rbd IronRuby 0.9.1.0 on .NET 2.0.50727.4918 Copyright (c) Microsoft Corporation. All rights reserved.>>> engine = IronRuby.create_engine=> Microsoft.Scripting.Hosting.ScriptEngine>>> engine.execute_file("foo.rb")=> Microsoft.Scripting.Hosting.ScriptScope>>> engine.execute_file("bar.rb")[D, C, Object, Kernel] => Microsoft.Scripting.Hosting.ScriptScope Tomas From: ironruby-core-bounces at rubyforge.org<mailto:ironruby-core-bounces at rubyforge.org> [mailto:ironruby-core-bounces at rubyforge.org]<mailto:[mailto:ironruby-core-bounces at rubyforge.org]> On Behalf Of CDurfee at tsys.com<mailto:CDurfee at tsys.com> Sent: Wednesday, September 30, 2009 8:58 AM To: ironruby-core at rubyforge.org<mailto:ironruby-core at rubyforge.org> Subject: Re: [Ironruby-core] calling ruby scripts from C# In our application, we also found we found ''load'' useful in some circumstances to force reloading of script files, since ''require'' will not reload files it knows it''s already loaded. -- Chuck -- Chuck Durfee Lead Software Architect, CentreSuite TSYS iSolutions, Golden Email cdurfee at tsys.com<mailto:cdurfee at tsys.com> Ivan Porto Carrero <ivan at flanders.co.nz<mailto:ivan at flanders.co.nz>> Sent by: ironruby-core-bounces at rubyforge.org<mailto:ironruby-core-bounces at rubyforge.org> 09/30/2009 09:41 AM Please respond to ironruby-core at rubyforge.org<mailto:ironruby-core at rubyforge.org> To ironruby-core at rubyforge.org<mailto:ironruby-core at rubyforge.org> cc Subject Re: [Ironruby-core] calling ruby scripts from C# root |_ lib |_ great_class.rb |_ test |_ test_great_class.rb let''s say I add root to my load path then I can reach the files in lib with require ''lib/great_class'' or in test_great_class.rb you can do require File.dirname(__FILE__) + "/../lib/great_class" you are free to add the extension in case you''re using require. --- Met vriendelijke groeten - Best regards - Salutations Ivan Porto Carrero Blog: http://flanders.co.nz<http://flanders.co.nz/> Twitter: http://twitter.com/casualjim Author of IronRuby in Action (http://manning.com/carrero) On Wed, Sep 30, 2009 at 4:23 PM, Eelco Henderichs <lists at ruby-forum.com<mailto:lists at ruby-forum.com>> wrote: Thanks! The require a file (containing the base) option works. But adding the path to the file containing the base class does not. Here C# reports an error that the file can not be found. Don''t what''s wrong here, but for know the require a file option will do the trick. -- Posted via http://www.ruby-forum.com/. _______________________________________________ Ironruby-core mailing list Ironruby-core at rubyforge.org<mailto:Ironruby-core at rubyforge.org> http://rubyforge.org/mailman/listinfo/ironruby-core _______________________________________________ Ironruby-core mailing list Ironruby-core at rubyforge.org<mailto:Ironruby-core at rubyforge.org> http://rubyforge.org/mailman/listinfo/ironruby-core ________________________________ The information contained in this communication (including any attachments hereto) is confidential and is intended solely for the personal and confidential use of the individual or entity to whom it is addressed. If the reader of this message is not the intended recipient or an agent responsible for delivering it to the intended recipient, you are hereby notified that you have received this communication in error and that any review, dissemination, copying, or unauthorized use of this information, or the taking of any action in reliance on the contents of this information is strictly prohibited. If you have received this communication in error, please notify us immediately by e-mail, and delete the original message. Thank you _______________________________________________ Ironruby-core mailing list Ironruby-core at rubyforge.org<mailto:Ironruby-core at rubyforge.org> http://rubyforge.org/mailman/listinfo/ironruby-core ________________________________ The information contained in this communication (including any attachments hereto) is confidential and is intended solely for the personal and confidential use of the individual or entity to whom it is addressed. If the reader of this message is not the intended recipient or an agent responsible for delivering it to the intended recipient, you are hereby notified that you have received this communication in error and that any review, dissemination, copying, or unauthorized use of this information, or the taking of any action in reliance on the contents of this information is strictly prohibited. If you have received this communication in error, please notify us immediately by e-mail, and delete the original message. Thank you _______________________________________________ Ironruby-core mailing list Ironruby-core at rubyforge.org<mailto:Ironruby-core at rubyforge.org> http://rubyforge.org/mailman/listinfo/ironruby-core ________________________________ The information contained in this communication (including any attachments hereto) is confidential and is intended solely for the personal and confidential use of the individual or entity to whom it is addressed. If the reader of this message is not the intended recipient or an agent responsible for delivering it to the intended recipient, you are hereby notified that you have received this communication in error and that any review, dissemination, copying, or unauthorized use of this information, or the taking of any action in reliance on the contents of this information is strictly prohibited. If you have received this communication in error, please notify us immediately by e-mail, and delete the original message. Thank you -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/ironruby-core/attachments/20090930/2e8ca95f/attachment.html>
No worries, I didn''t read your comment as rude. I fully realize the error of my ways in not embracing Ruby earlier in my career. ;) It''s just an interesting thing to keep in mind with projects like IronRuby, that people come to it with different backgrounds. It will be interesting to see what sort of orientation documents are produced for those coming to IronRuby from a .NET (C#/VB.NET) background. I foresee articles like these from the days when C# was young: C++ -> C#: What You Need to Know to Move from C++ to C# http://msdn.microsoft.com/en-us/magazine/cc301520.aspx C# From a Java Developer''s Perspective http://www.25hoursaday.com/CsharpVsJava.html -- Chuck -- Chuck Durfee Lead Software Architect, CentreSuite TSYS iSolutions, Golden Email cdurfee at tsys.com Jim Deville <jdeville at microsoft.com> Sent by: ironruby-core-bounces at rubyforge.org 09/30/2009 02:26 PM Please respond to ironruby-core at rubyforge.org To "ironruby-core at rubyforge.org" <ironruby-core at rubyforge.org> cc "ironruby-core-bounces at rubyforge.org" <ironruby-core-bounces at rubyforge.org> Subject Re: [Ironruby-core] calling ruby scripts from C# Apologies if my earlier answer was rude. I wasn?t trying to be rude, and looking at it I realize it could be taken as such. I know I appreciate hearing that people are using IronRuby on real projects, not just as a novelty language J Thanks, JD From: ironruby-core-bounces at rubyforge.org [mailto:ironruby-core-bounces at rubyforge.org] On Behalf Of CDurfee at tsys.com Sent: Wednesday, September 30, 2009 11:32 AM To: ironruby-core at rubyforge.org Cc: ironruby-core at rubyforge.org; ironruby-core-bounces at rubyforge.org Subject: Re: [Ironruby-core] calling ruby scripts from C# Indeed. We came to Ruby from C#, so it wasn''t immediately obvious to us. Thanks! -- Chuck -- Chuck Durfee Lead Software Architect, CentreSuite TSYS iSolutions, Golden Email cdurfee at tsys.com Jim Deville <jdeville at microsoft.com> Sent by: ironruby-core-bounces at rubyforge.org 09/30/2009 11:38 AM Please respond to ironruby-core at rubyforge.org To "ironruby-core at rubyforge.org" <ironruby-core at rubyforge.org> cc "ironruby-core-bounces at rubyforge.org" <ironruby-core-bounces at rubyforge.org>Subject Re: [Ironruby-core] calling ruby scripts from C# Makes sense, that?s standard Ruby for you. JD From: ironruby-core-bounces at rubyforge.org [mailto:ironruby-core-bounces at rubyforge.org] On Behalf Of CDurfee at tsys.com Sent: Wednesday, September 30, 2009 10:30 AM To: ironruby-core at rubyforge.org Cc: ironruby-core at rubyforge.org; ironruby-core-bounces at rubyforge.org Subject: Re: [Ironruby-core] calling ruby scripts from C# Agreed. We found if we changed the definition of class C, unless we did something like ''load'', it would continue to use the old definition from the first load. -- Chuck -- Chuck Durfee Lead Software Architect, CentreSuite TSYS iSolutions, Golden Email cdurfee at tsys.com Tomas Matousek <Tomas.Matousek at microsoft.com> Sent by: ironruby-core-bounces at rubyforge.org 09/30/2009 10:27 AM Please respond to ironruby-core at rubyforge.org To "ironruby-core at rubyforge.org" <ironruby-core at rubyforge.org> cc Subject Re: [Ironruby-core] calling ruby scripts from C# If the base class is defined in file ?foo.rb? and used in file ?bar.rb? this should also work: engine.ExecuteFile(?foo.rb?); engine.ExecuteFile(?bar.rb?); Example: C:\Temp>type foo.rb class C end C:\Temp>type bar.rb class D < C end p D.ancestors C:\Temp>rbd IronRuby 0.9.1.0 on .NET 2.0.50727.4918 Copyright (c) Microsoft Corporation. All rights reserved.>>> engine = IronRuby.create_engine=> Microsoft.Scripting.Hosting.ScriptEngine>>> engine.execute_file("foo.rb")=> Microsoft.Scripting.Hosting.ScriptScope>>> engine.execute_file("bar.rb")[D, C, Object, Kernel] => Microsoft.Scripting.Hosting.ScriptScope Tomas From: ironruby-core-bounces at rubyforge.org [mailto:ironruby-core-bounces at rubyforge.org] On Behalf Of CDurfee at tsys.com Sent: Wednesday, September 30, 2009 8:58 AM To: ironruby-core at rubyforge.org Subject: Re: [Ironruby-core] calling ruby scripts from C# In our application, we also found we found ''load'' useful in some circumstances to force reloading of script files, since ''require'' will not reload files it knows it''s already loaded. -- Chuck -- Chuck Durfee Lead Software Architect, CentreSuite TSYS iSolutions, Golden Email cdurfee at tsys.com Ivan Porto Carrero <ivan at flanders.co.nz> Sent by: ironruby-core-bounces at rubyforge.org 09/30/2009 09:41 AM Please respond to ironruby-core at rubyforge.org To ironruby-core at rubyforge.org cc Subject Re: [Ironruby-core] calling ruby scripts from C# root |_ lib |_ great_class.rb |_ test |_ test_great_class.rb let''s say I add root to my load path then I can reach the files in lib with require ''lib/great_class'' or in test_great_class.rb you can do require File.dirname(__FILE__) + "/../lib/great_class" you are free to add the extension in case you''re using require. --- 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 Wed, Sep 30, 2009 at 4:23 PM, Eelco Henderichs <lists at ruby-forum.com> wrote: Thanks! The require a file (containing the base) option works. But adding the path to the file containing the base class does not. Here C# reports an error that the file can not be found. Don''t what''s wrong here, but for know the require a file option will do the trick. -- Posted via http://www.ruby-forum.com/. _______________________________________________ Ironruby-core mailing list Ironruby-core at rubyforge.org http://rubyforge.org/mailman/listinfo/ironruby-core _______________________________________________ Ironruby-core mailing list Ironruby-core at rubyforge.org http://rubyforge.org/mailman/listinfo/ironruby-core The information contained in this communication (including any attachments hereto) is confidential and is intended solely for the personal and confidential use of the individual or entity to whom it is addressed. If the reader of this message is not the intended recipient or an agent responsible for delivering it to the intended recipient, you are hereby notified that you have received this communication in error and that any review, dissemination, copying, or unauthorized use of this information, or the taking of any action in reliance on the contents of this information is strictly prohibited. If you have received this communication in error, please notify us immediately by e-mail, and delete the original message. Thank you _______________________________________________ Ironruby-core mailing list Ironruby-core at rubyforge.org http://rubyforge.org/mailman/listinfo/ironruby-core The information contained in this communication (including any attachments hereto) is confidential and is intended solely for the personal and confidential use of the individual or entity to whom it is addressed. If the reader of this message is not the intended recipient or an agent responsible for delivering it to the intended recipient, you are hereby notified that you have received this communication in error and that any review, dissemination, copying, or unauthorized use of this information, or the taking of any action in reliance on the contents of this information is strictly prohibited. If you have received this communication in error, please notify us immediately by e-mail, and delete the original message. Thank you _______________________________________________ Ironruby-core mailing list Ironruby-core at rubyforge.org http://rubyforge.org/mailman/listinfo/ironruby-core The information contained in this communication (including any attachments hereto) is confidential and is intended solely for the personal and confidential use of the individual or entity to whom it is addressed. If the reader of this message is not the intended recipient or an agent responsible for delivering it to the intended recipient, you are hereby notified that you have received this communication in error and that any review, dissemination, copying, or unauthorized use of this information, or the taking of any action in reliance on the contents of this information is strictly prohibited. If you have received this communication in error, please notify us immediately by e-mail, and delete the original message. Thank you _______________________________________________ Ironruby-core mailing list Ironruby-core at rubyforge.org http://rubyforge.org/mailman/listinfo/ironruby-core ----------------------------------------- The information contained in this communication (including any attachments hereto) is confidential and is intended solely for the personal and confidential use of the individual or entity to whom it is addressed. If the reader of this message is not the intended recipient or an agent responsible for delivering it to the intended recipient, you are hereby notified that you have received this communication in error and that any review, dissemination, copying, or unauthorized use of this information, or the taking of any action in reliance on the contents of this information is strictly prohibited. If you have received this communication in error, please notify us immediately by e-mail, and delete the original message. Thank you -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/ironruby-core/attachments/20090930/866c3893/attachment.html>