From: Steve Tuckner Date: 2004-09-29T12:26:44+09:00 Subject: Re: DRY ruby idiom Florian Gross wrote: > require 'binding_of_caller' > > def and_set(name, value) > return if value.nil? > Binding.of_caller do |context| > eval("#{name} = ObjectSpace._id2ref(#{value.id})", context) > end > end > > and_set(:var, val) > > Not sure if you were looking for this kind of solution though. :) > It probably does the trick (though I can't understand the binding_of_caller without more study), but was quite a bit more heavyweight than I was looking for. Thanks for trying... ;-) Steve Tuckner