From: "Bartosz Dziewoński" Date: 2012-02-21T02:19:41+09:00 Subject: Re: Metaprograming question about initialize 2012/2/20 Ralph Shnelvar : > > What I want to do is not change the interface but the implementation.  That is, I want to get a list of the names of the arguments by introspection. It is much simpler and IMO makes much more sense not to figure out variable names while already having variables, but to figure out their contents while having names. Like this: class Class def attr_accessor_init *meths attr_accessor *meths define_method :initialize do |*args| meths.each_with_index do |m, i| self.send :"#{m}=", args[i] end end end end irb(main):013:0> class A irb(main):014:1> attr_accessor_init :a, :b, :c irb(main):015:1> end irb(main):029:0> A.new 4, 6, 8 => # (This is, essentially, what Struct class does.) -- Matma Rex