From: Xie Hanjian Date: 2009-02-03T02:30:49+09:00 Subject: Re: FInding out the name of the method from which I was called? --82I3+IH0IqGh5yIs Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable * R. Pito Salas [2009-02-03 02:17:29 +0900]: > Is there a clever meta programming way for me to do this: > > def calling_method_1 > > reporting_method > > end > > > def reporting_method_2 > > puts "Hey I was just called from #{magic}" > > end def reporting_method caller.shift end Check Kernel#caller. Jan > > and when running reporting_method_2 this prints > > Hey I was just called from calling_method_1 > > Thanks for any pointers! > > -- Pito --=20 jan=3Dcallcc{|jan|jan};jan.call(jan) --82I3+IH0IqGh5yIs Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (GNU/Linux) iQEcBAEBAgAGBQJJhy3UAAoJEBcDvo3O83d67IIIAIYIX/HI+m9XchS0FG3+dcJt uitu2HTO3f2SNLIKyPOV1WQyJQERpRc8yKGNyJMBpEiYAhxrhx0YDDKujNJNm1/5 emdpxrZaR1ww+jHmMoT2IvW6wYdFJemzOcA4WyqdzJUXa74LOL5wuoED47yRfwLh 7DZdge0KDZN8XqpfL/RTvCGG6954Wza9IEeUJqWEJJmTSahdDwL3DIQH1Jab0rrf fY/qPY8d+3dBL0UYNlzsrvlCaWDGlrmNDNAzsS2tZT68SoojYxwtsWzuCPmTPRAQ 1oztJyuxq8OhPwPHACDFsvk4lhQmx4PZFBqesbe8RqRHVZE0lJg6SfGp4xupS0k= =8n4A -----END PGP SIGNATURE----- --82I3+IH0IqGh5yIs--