views:

32

answers:

2

I am exploring an big controller method, with about 10 or so instance variables. Some of them are set in before_filter methods, and some others inside the method itself. I want to inspect them with puts, but dont want to write all of them out example:

puts "var1: #{@var1.inspect}....var15: #{@var15.inspect}"

Is there a generic method that will display all the instance variables with an @ sign set so far in the current method? If not, what is the next best way to inspect all of them at once without having to write all of them in a puts statement?

+3  A: 

You can use instance_values method to get all instance variables for the object as a hash:

Voyta