I
Intransition
I'm evaluating a ruby script against a testing DSL that I wrote. Now I
would have loved to run the scripts at the toplevel, but the
contamination of the Object class makes that infeasible. So I run them
within a Scope object. Basically:
class Scope < Module
def initialize
extend self
end
def execute(script, filename)
eval(script, binding, filename)
end
end
My problem arises when a script uses a constant that isn't defined and
the error message looks like this:
ERROR: NameError uninitialized constant #<Scope:0x7f3cc21e5630>::Foo
I'm trying to find a way to get rid of the `#<Scope:...>::` part. To
the end user it should at least *look* like things are running at
toplevel.
I tried adding to Scope:
def inspect; ""; end
But that did not work. Any ideas?
would have loved to run the scripts at the toplevel, but the
contamination of the Object class makes that infeasible. So I run them
within a Scope object. Basically:
class Scope < Module
def initialize
extend self
end
def execute(script, filename)
eval(script, binding, filename)
end
end
My problem arises when a script uses a constant that isn't defined and
the error message looks like this:
ERROR: NameError uninitialized constant #<Scope:0x7f3cc21e5630>::Foo
I'm trying to find a way to get rid of the `#<Scope:...>::` part. To
the end user it should at least *look* like things are running at
toplevel.
I tried adding to Scope:
def inspect; ""; end
But that did not work. Any ideas?