From: Josh Cheek Date: 2010-04-01T01:23:15+09:00 Subject: Re: RubyDictionary - First Try --000e0cd11326887fc704831b291d Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable 2010/3/31 Jes=FAs Gabriel y Gal=E1n > 1.- > def initialize(entries=3Dnil) > if entries=3D=3Dnil > @entries =3D Array.new > else > @entries =3D entries > end > end > > this could be done like this: > > def initialize(entries=3Dnil) > @entries =3D entries || [] # or Array.new if you prefer > end > > How about def initialize( entries =3D Array.new ) @entries =3D entries end BTW, I think it is better to use setters and getters than to directly acces= s the ivars, because if you restrict access to the method, then you only have to go to one place if you change implementation. --000e0cd11326887fc704831b291d--