Actions
Feature #11087
closedMethod to retrieve {local,global,instance} variables as a Hash
Description
Rails implemented Object#instance_values which returns all the instance variables as a hash.
This is used for serialization, but it is pretty useful for introspection, debugging and reporting as well. (For example, it could be used to implement something like this.)
I was going to propose an equivalent for local variables (and I suppose global variables too, for completeness), but if there are interest maybe we can do this on Ruby instead.
There are also some open questions:
- Naming
- Hash or iterator? (like Rails'
Object#instance_value
or likeObjectSpace.each_object
) - Rails'
Object#instance_values
removes the leading@
, are we going to do the same? (Probably not?)
Actions
Like0
Like0Like0