From: John Sikora Date: 2009-09-05T02:24:12+09:00 Subject: Re: Is Passing a Binding with Parameters Possible? Space Ship Traveller wrote: > I like lmgtfy: > > http://lmgtfy.com/?q=Binding+of_caller > > Kind regards, > Samuel SST, Thanks for the link. No one has ever accused me of being particularly adept at conducting a web search. Unfortunately, I feel even more ignorant because I cannot get the code to work. At first I tried adapting the code in my post to use Binding.of_caller. When it did not work, I tried the example code from the link: require 'c:/Ruby/lib/ruby/gems/1.8/gems/extensions-0.6.0/lib/extensions/binding' def inc_counter Binding.of_caller do |b| eval("counter += 1", b) end end counter = 0 inc_counter inc_counter puts counter I get an error message that says: in 'inc_counter': undefined method '+' for nil:NilClass. So it is not getting the correct binding. Debugging shows that Binding.of_caller returned a binding to inc_counter. The code in the require file matches the source code of of_caller in the link, so at least I know that is right. Is there something obvious am I doing wrong? I am running Ruby 1.8.6 on Windows. I will try to educate myself by studying the source code to figure out what is wrong, but it will take some time (if I ever get there). Thanks, John S. -- Posted via http://www.ruby-forum.com/.