hacks/each_instance_variable |
class Object < Object |
Private Methods |
Iterate over every instance variable in the given object, yielding [ name, obj ], where name is the Symbol representing the name of the instance variable, and obj is the instance variable itself.
This is useful for operations such as deep freeze and deep copy. It can also come in handy for writing custom marshallers. A less common use would be to access instance variables whose name do not begin with the @ character (such as the Exception class's mesg variable).