I want to read the values of instance variables in an object, but I
don’t know how to reach them. I think the code should be something
like:
def read_stuff
s = “Class: #{self.class}:\n”
s += “Instance variables:\n”
self.instance_variables.each do
|var|
s += “#{var}: #{SOMETHING}\n”
end
s += “\n”
end
But I don’t know what to replace SOMETHING with. Anyone know?
I want to read the values of instance variables in an object, but I
don’t know how to reach them. I think the code should be something
like:
def read_stuff
s = “Class: #{self.class}:\n”
s += “Instance variables:\n”
self.instance_variables.each do
|var|
s += “#{var}: #{SOMETHING}\n”
end
s += “\n”
end
But I don’t know what to replace SOMETHING with. Anyone know?