Albert Wagner <alwagner / tcac.net> writes:

> I see some class definitions contain "include" and "extend" statements. 
> I can find no doc refs to these.  Also, "autoload".  If these are in the
> manual or user guide, please point me in the right direction.  Is there
> an english translation to ruby-1.4.4/ext/tcltklib/MANUAL.euc?  Thanks
> ahead for any help.

Both include and extend take one or more modules and add their methods 
and constants in to something: include adds in to a class definition,
which extend adds to a particular object.

For example

  module Cheery
    def hello
      puts "Toodle-pip, old chap!"
    end
  end

  class Person
    include Cheery
    def other
      puts "other"
    end
  end

  p = Person.new
  p.hello    #=> Toodle-pip, old chap!
  p.other    #=> other


  s = "A String"
  s.extend Cheery
  s.hello    #=> Toodle-pip, old chap!


Every language needs Cheery strings.



Dave