In Ruby, you can easily access local variables programmatically using local_variables and eval . I would really like to have metaprogramming access to these variables using one method call, for example
where Foo is some external module. The idea is to display and export local variables in a beautiful way.
What should be inside the explore_locals method? Is there any way to make this possible? If absolutely necessary, I think it could be
Foo.explore_locals binding
but it is much less elegant for the application that I mean.
Peter source share