On Tue, 27 Feb 2001, Avi Bryant wrote:

> How about something that'll generate the initializers for you - so that
> you could do
> 
> class Foo
> 	initializer(:bar, :baz) do
> 		#other stuff for initialize to do
> 	end
> end

e.g:

class Class
	def initializer(*args, &b)
		define_method(:__init_proc) {b}
		params = args.join(", ")
		vars = args.collect{|a| "@#{a}"}.join(", ")
		
		class_eval <<-EOS
			def initialize(#{params})
				#{vars} = #{params}
				instance_eval &__init_proc
			end
		EOS
	end
end