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: [email protected]
[mailto:[email protected]] On Behalf Of [email protected]
Sent: Wednesday, September 30, 2009 8:58 AM
To: [email protected]
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 [email protected]<mailto:[email protected]>
Ivan Porto Carrero <[email protected]<mailto:[email protected]>>
Sent by:
[email protected]<mailto:[email protected]>
09/30/2009 09:41 AM
Please respond to
[email protected]<mailto:[email protected]>
To
[email protected]<mailto:[email protected]>
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
<[email protected]<mailto:[email protected]>> 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
[email protected]<mailto:[email protected]>
http://rubyforge.org/mailman/listinfo/ironruby-core
_______________________________________________
Ironruby-core mailing list
[email protected]<mailto:[email protected]>
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
[email protected]
http://rubyforge.org/mailman/listinfo/ironruby-core