Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>uh, eval is not perhaps the most golden of standards. You could probably fire up a drb instance and run the stuff in that instead of eval, that way you would have at least some control of what is happening and not pollute your own namespace.</p> <p><a href="http://segment7.net/projects/ruby/drb/introduction.html" rel="nofollow noreferrer">http://segment7.net/projects/ruby/drb/introduction.html</a></p> <hr> <p>Edit: added another answer for running the code in the same process:</p> <p>I don't know how your rule code looks, but it might be possible to wrap a module around it:</p> <pre><code># create a module module RuleEngineRun1;end # run code in module RuleEngineRun1.module_eval("class Foo;end") # get results #.... # cleanup Object.send(:remove_const, :RuleEngineRun1) </code></pre> <p>You can also create an anonymous module with Module.new { #block to be module eval'd } if you need to run code in parallel.</p> <hr> <p>In later rubies you can add -W0 to run your code without printing warnings, but doing so makes possible errors go unnoticed:</p> <pre><code>$ cat foo.rb FOO = :bar FOO = :bar $ ruby foo.rb foo.rb:2: warning: already initialized constant FOO $ ruby -W0 foo.rb </code></pre> <p>You could also run your eval inside a Kernel.silence_warnings block, but might be devastating as well if you actually run into some real problems with the eval'd code, see <a href="https://stackoverflow.com/questions/5591509/suppress-ruby-warnings-when-running-specs">Suppress Ruby warnings when running specs</a></p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload