How to strip() all instance var of class instance?

Something like x.instance_variables.each… { |i} … }

Ought to be a one liner. I can’t figure out how to apply strip() to each variable, since instance_variable_get returns the value. I really want something I can apply .strip! to…

What make you think you can't do that to the result from instance_variable_get ?

Fred

You are correct - this works. But, why? Doesn’t instance_variable_get return the value of a variable, not the actual variable itself?

You are correct - this works. But, why? Doesn't instance_variable_get return the value of a variable, not the actual variable itself?

instance_variable_get(:@foo) evaluates exactly the same object as @foo.

Fred