Laughlin, Joseph V wrote: > How can I do something like the following: > > class Foo > > attr_accessor :goo, :moo > > def initalize > @attr.each { | attrib| attrib = 0 } > end > end > > In case it's not clear, I want to set all attributes of the Foo object > to zero. But I can't seem to get the syntax for it correct. class Foo attr_accessor :goo, :moo def initialize methods.grep(/^\w+\=$/) {|m| send m, 0} end end f = Foo.new p f # ==> #<Foo:0x401c6bec @goo=0, @moo=0>