From: Trans Date: 2007-11-01T05:33:31+09:00 Subject: Re: Generation of initialize On Oct 31, 4:10 pm, arcadiorubiogar...@gmail.com wrote: > Hi again, > > I'm trying to enhance the previous solution (shown again at the end). > I'd like to call the initialize method of the superclass from the > generated initialize. For the moment it's ok to call it without > parameters. Simply placing super inside the method definition doesn't > work. Can anyone explain me how to do it. Thanks in advance. Why doesn't it work? def initialize_with(*params) define_method(:initialize) do |*args| if args.size != params.size then raise ArgumentError.new("wrong number of arguments"\ " (#{args.size} for #{params.size})") end super() if defined?(super) params.zip(args) do |param, arg| instance_variable_set("@#{param}", arg) end end return params end The "()" on super clears the auto-passing of parameters. T.