
Issue #21365 has been updated by Eregon (Benoit Daloze). Yep, agreed it'd be far more convenient for testing Namespace. matheusrich (Matheus Richard) wrote in #note-1:
I'm curious why `eval` and not `instance_eval`?
Why `instance_eval`? The distinction between eval/class_eval/instance_eval does not seem relevant here. Though of course the semantics should be the same as writing the code to a file + `Namespace#require` so e.g. `ns.eval "def foo = 42"` defines method `foo` on ns' copy of Object methods. ---------------------------------------- Feature #21365: Add `Namespace#eval` https://bugs.ruby-lang.org/issues/21365#change-113396 * Author: tenderlovemaking (Aaron Patterson) * Status: Open ---------------------------------------- I would like a way to eval code on to a `Namespace` object. Could we add an eval method that _doesn't_ take a binding object? Writing a new file every time I want to test Namespaces is too cumbersome. Thanks! -- https://bugs.ruby-lang.org/