From: ts Date: 2001-11-29T15:21:45+09:00 Subject: [ruby-talk:26872] Re: Wishing for instance_yield or the equivalent >>>>> "H" == Hal E Fulton writes: H> But it means when I call it, I can't use local variables Well I've not understood your problem pigeon% cat b.rb #!/usr/bin/ruby class MyClass attr_accessor :alpha, :beta, :gamma def initialize(&block) instance_eval &block end def inspect "[#{@alpha} #{@beta} #{@gamma}]" end end x = 5; y = 6; z = 7 obj = MyClass.new { @alpha = x; @beta = y; @gamma = z } p obj pigeon% pigeon% b.rb [5 6 7] pigeon% Guy Decoux