February 2, 2004 Intro to Ruby Slide #24
Prev Next

Access Control

Ruby has three levels of access for methods:

     Class MyClass

         def meth1  # public by default
            ...
         end

       protected

         def meth2  # protected
            ...
         end

       private

         def meth3  # private
            ...
         end

       public

         def meth4  # explicitly public
            ...
         end


Prev Copyright © 2004 Walter C. Mankowski Next