From: Trans Date: 2006-09-25T07:20:15+09:00 Subject: Re: How do I create an attribute accessor to do this... J2M wrote: > I want to be able to do this to merge a hash into attribute bas on > instance bar in class foo; > > bar = Foo.new > bar.bas << { :this => "that" } > > Is there any way to define the accessor in Foo to be able to do this? > > Thanks, > James class Hash alias :<<, :merge! end class Foo attr :bas def initialize @bas = {} end end Is that what you had in mind? T.