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 <li...@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@rubyforge.org
> http://rubyforge.org/mailman/listinfo/ironruby-core
>
_______________________________________________
Ironruby-core mailing list
Ironruby-core@rubyforge.org
http://rubyforge.org/mailman/listinfo/ironruby-core

Reply via email to