From: ts Date: 2003-05-08T22:58:25+09:00 Subject: Re: [Q] Block passing: obj.new(){block} >>>>> "P" == Peter Schrammel writes: P> t=Test.new("foo"){set=89} pigeon% cat b.rb #!/usr/bin/ruby class Test def initialize(foo, &block) instance_eval(&block) end def set=(myval) @set=myval end def set @set end end t=Test.new("foo") { self.set = 89 } puts t.set pigeon% pigeon% b.rb 89 pigeon% See `self.set=' otherwise ruby will think that you want to access the local variable `set' Guy Decoux