From: Brian Candler Date: 2012-04-29T18:43:59+09:00 Subject: Re: list local_variables in a def by means of a method Ronnie Aa wrote in post #1058797: > Thank you Bartosz > > I can work from here! Aside: every time you pass a block, you are also passing a binding implicitly. So you can change this to: class A def stuff a = 4 foo = 'asd' list_vars {} end def list_vars &blk bnd = blk.binding bnd.eval('local_variables').each{|var| val = bnd.eval(var.to_s) puts "#{var} is #{val.class} and is equal to #{val.inspect}" } end end A.new.stuff If you can think of something useful to do with the block, then it will look less odd than passing an empty one :-) -- Posted via http://www.ruby-forum.com/.