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?

-- 
Posted via http://www.ruby-forum.com/.