On Mon, 3 Jul 2006, kevin kinnett wrote: > I am trying to simulate Eiffel's ability to make methods in a class only > available to specific other classes. I know it is probably impossible to > make methods only visible to certain other classes, but is there a way > to make a class throw an exception if called by the wrong class? > > For instance: > > class Foo > def bar > if calling_class.class != some_other_class.class > raise An_Entry_Exception.new > end > ¡Ärest of class > end > end > > Specifically is there a way to see what the class of whatever is calling > a method is (like the variable 'calling_class' above)? Or does anyone > know of a project that simulates this functionality? class Foo def bar unless [One, Two, Three].include? self.class raise An_Entry_Exception.new end end end -a -- suffering increases your inner strength. also, the wishing for suffering makes the suffering disappear. - h.h. the 14th dali lama