From: Sean Chittenden Date: 2001-07-24T05:56:45+09:00 Subject: [ruby-talk:18385] Re: More newbie questions --9amGYk9869ThD9tj Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable > On Tue, 24 Jul 2001, Dave Thomas wrote:=20 > > Matt writes: > >=20 > > > cgi.out { cgi.p { cgi.rfc1123_date (Time.now) } } > >=20 > > rfc1123_date is a class method of CGI, as opposed to an instance > > method. This means you'd call it using > >=20 > > CGI.rfc1123_date(Time.now) > >=20 > > Here you're using the class (CGI) as the receiver of the message, as > > opposed to an instance of the class (cgi in your example). >=20 > OK. That worked! Now I'm confused (again) when to use the class and > when to use an instance. For example take rfc1123_date. Why wasn't it > inherited by the instance? I don't know the answer to that, but I'm sure someone else on this list does. > I admit to not knowing enough about OO, but > the only other language I've ever really tried was Perl's OO. And I > hated it. ;) It's not _that_ bad, is it? After years of using it, I can't contain the joy that using ruby brings to my tired blessed hash life. =20 ;~) I'd check out page 26.27 of the Programming Ruby book. =20 Actually, check out the index under "Class -> instance" and "Class ->=20 method". As for the diff between CGI class and instance methods, look=20 at 501, 504. -sc --=20 Sean Chittenden --9amGYk9869ThD9tj Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Comment: Sean Chittenden iEYEARECAAYFAjtcj2wACgkQn09c7x7d+q141ACgru4eWknKHQROSSDS9+dELTDN 3IkAn3lO33ggGstIpcthxybmgNBTc7fR =9aw4 -----END PGP SIGNATURE----- --9amGYk9869ThD9tj--