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…
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…
On Thursday, July 2, 2015 at 5:21:51 AM UTC+1, [email protected] wrote:
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
On Thursday, July 2, 2015 at 7:06:58 PM UTC+1, [email protected] wrote:
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
You are correct - this works. But, why? Doesn’t instance_variable_get
return the value of a variable, not the actual variable itself?
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.
Sponsor our Newsletter | Privacy Policy | Terms of Service | Remote Ruby Jobs