I want to destroy a variable in ruby as if it had never existed. Here is an example:
> defined? a
=> "nil"
> a = 1
> defined? a
=> "local-variable"
Now I need to set variable a to "nil" when I do defined?.
I tried some things like:
> a = nil #Not working
=> nil
> defined? a 
=>  "local-variable"
But nothing seems to work.
As of now (MRI 2.2 and before), there's no way to do this.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With