Hi, Is there anyway to clear all global variables from the IronRuby script engine? For example if I define a variable in a script and execute it: $myVar = "Hello" And then execute another script in a new scriptscope but with the same ScriptEngine instance and use: global_variables.each do |var| print("#{var} = #{eval(''$'' + var)}") end Then the myVar variable from the first instance will be listed. Thanks, Aaron -- Posted via http://www.ruby-forum.com/.
Ivan Porto Carrero
2009-Sep-30 13:47 UTC
[Ironruby-core] Clear ScriptEngine Global Variables
if (Runtime.Globals.ContainsVariable(className)) Runtime.Globals.RemoveVariable(className); --- 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:43 PM, Aaron Clauson <lists at ruby-forum.com> wrote:> Hi, > > Is there anyway to clear all global variables from the IronRuby script > engine? > > For example if I define a variable in a script and execute it: > > $myVar = "Hello" > > And then execute another script in a new scriptscope but with the same > ScriptEngine instance and use: > > global_variables.each do |var| > print("#{var} = #{eval(''$'' + var)}") > end > > Then the myVar variable from the first instance will be listed. > > Thanks, > > Aaron > -- > 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/6ea8bafb/attachment.html>
Ivan Porto carrero wrote:> if (Runtime.Globals.ContainsVariable(className)) > Runtime.Globals.RemoveVariable(className); >What if i don''t know classname though? My application is operating in a shared environment where a large number of users are each executing their own custom scripts. Thanks, Aaron -- Posted via http://www.ruby-forum.com/.
Ivan Porto Carrero
2009-Sep-30 15:20 UTC
[Ironruby-core] Clear ScriptEngine Global Variables
Do you want to do it from ruby or from C#? --- 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:07 PM, Aaron Clauson <lists at ruby-forum.com> wrote:> Ivan Porto carrero wrote: > > if (Runtime.Globals.ContainsVariable(className)) > > Runtime.Globals.RemoveVariable(className); > > > > What if i don''t know classname though? > > My application is operating in a shared environment where a large number > of users are each executing their own custom scripts. > > Thanks, > > Aaron > > -- > 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/2686d4f4/attachment.html>