From: Robert Klemme Date: 2004-05-07T17:43:56+09:00 Subject: Re: use the ruby's stack for security "guillaume.dorchies" schrieb im Newsbeitrag news:pan.2004.05.06.20.54.38.101864@wanadoo.fr... > Hello, > > I need to play with the internal stack of the interpreter like this > > class A > def foo2 > C.new.foo > end > end > > class B > def foo2 > C.new.foo > end > end > > class C > def foo > klass=who_is_calling_me > if klass == A > puts 'GOOD' > elsif klass == B > puts 'BAD' > end > end > end > > and now I want > > A.new.foo2 > >GOOD > B.new.foo2 > >BAD > > the method who_is_calling_me must use the internal stack but how ??? here > I use one level but in a real case there is a lot of levels > I can't send this information via call to method > > I need this mechanisme to implement a security system. > A logon session have all the informations for the security and all the > objects called by the loggon session can use this informations to check > security > > Anybody have an idea or it's impossible Either you can use caller or you use set_trace_func to remember the stack. robert