Trans
9/24/2006 10:20:00 PM
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.