From: ts Date: 2001-02-28T20:33:48+09:00 Subject: [ruby-talk:11761] Re: inheritance and mixins >>>>> "M" == Max Ischenko writes: M> Then, how can I write initialize method for Downloader module which won't be M> called by RpmPackage but will be executed at module creation? Perhaps I've not understood but #initialize is called when a new object is created. ruby call #append_features when a module is included in a class, this mean that you can write something like this pigeon% cat b.rb #!/usr/bin/ruby module Downloader @@init = false def Downloader.append_features(klass) if !@@init puts "\tDownloader #{klass}" @@init = true end super end end class Package def initialize puts "\tPackage" end end puts "BEFORE include" class RpmPackage < Package include Downloader def initialize puts "\tRpmPackage" super end end puts "BEFORE new" RpmPackage.new pigeon% pigeon% pigeon% b.rb BEFORE include Downloader RpmPackage BEFORE new RpmPackage Package pigeon% M> And another minor thing, did getenv() is missing and am I right with M> TMPDIR = `echo $TMPDIR`.chomp + '/softwatcher/' the Hash variable ENV pigeon% ruby -e 'puts ENV["HOSTNAME"]' pigeon pigeon% Guy Decoux