sample/export.rb


DEFINITIONS

This source file includes following functions.


   1  # method access permission
   2  # output:
   3  #       foobar
   4  #       Foo
   5  
   6  class Foo
   7    public :printf
   8    def baz
   9      print "baz\n"
  10    end
  11    private :baz
  12  
  13    def quux
  14      print "in QUUX "
  15      baz()
  16    end
  17  end
  18  
  19  def foobar
  20    print "foobar\n"
  21  end
  22  
  23  f = Foo.new
  24  #Foo.private :printf
  25  class Foo                       # redefines foobar's scope
  26    public :foobar
  27  end
  28  f.foobar
  29  f.printf "%s\n", Foo
  30  
  31  f.quux
  32  
  33  class Bar<Foo
  34    def quux
  35      super
  36      baz()
  37    end
  38  end
  39  
  40  Bar.new.quux