From: "Shot (Piotr Szotkowski)" Date: 2008-11-25T07:17:36+09:00 Subject: Re: my attr_accessor --P+33d92oIH25kiaB Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable cibercitizen1: > I tried to > class Foo > attr_accessor :bar1, :bar2 >=20 > def initialize( &bloc ) > instance_eval( &bloc ) > end > end > and then > f =3D Foo.new { > bar1 =3D 12345 > bar2 =3D 44444 > } > but this doesn't work > unless you write @bar1=3D12345 in the block, as > Ruby does not consider bar1=3D a method call but an assignment. Right, unless you precede it with self: f =3D Foo.new { self.bar1 =3D 12345 self.bar2 =3D 44444 } -- Shot --=20 > The problem with Perl is not that it doesn't make sense, because it does.= =2E. Everything in Perl is there for a reason. Which is a bit scary, if you think about it. -- Peter da Silva and Phil!Gregory, hates-softwa= re --P+33d92oIH25kiaB Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.2.2 (GNU/Linux) iD8DBQFJKyUGi/mCfdEo8UoRAlYcAKCUdWDhZ1D4rkliFNZUsfcLlUmQ5QCgu8T/ PLXNW+sSddotrmL/GeWPAZo= =M0M9 -----END PGP SIGNATURE----- --P+33d92oIH25kiaB--