From: Eero Saynatkari Date: 2006-10-28T02:12:14+09:00 Subject: Re: classless methods --5vb8QKeSi34BFwx0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On 2006.10.28 01:10, Dave Rose wrote: > what class does a classless independent method belong too? > another words if i just make an new irb session and type: >=20 > def widget(tidbit) > tidbit > end >=20 > a=3D1.0 > puts widget(a) >=20 > b=3D'string' >=20 > puts widget(b) >=20 > what class will the widget method belong too? Ruby can tell you. def widget # ... end p method('widget') # =3D> # p Object.methods.include? 'widget' # =3D> true=20 p Object.ancestors # =3D> [Object, Kernel] p Kernel.methods.include? 'widget' # =3D> true=20 --5vb8QKeSi34BFwx0 Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.5 (FreeBSD) iD8DBQFFQj1Y7Nh7RM4TrhIRAuRxAKDCdjQYRNvXDEYX1Mj9VG9bonUGPgCgocMF Prg9lfPt0xaky9ryqSn+rkQ= =zLWP -----END PGP SIGNATURE----- --5vb8QKeSi34BFwx0--