>>>>> "H" == Hal E Fulton <hal9000 / hypermetrics.com> 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