Hi,

Am 01.02.2011 10:02, schrieb Kamarulnizam Rahim:
> Thanks for your post. Actually, i dont want every subclasses to has its
> own yaml file because the purpose of my program is to produce a sole
> yaml file, with all data (@title) from every subclasses included in that
> file.
>
> Btw, what do you meant by
>
> 'I think what you want is one class instance variable for all
> subclasses' ?

Sorry, I meant a class variable (@@var).

> can you show a simple example on that? One more thing, i saw on net
> there is a way by using '@@xxxx' variable and that variable can be
> called outside the class. Is it true?

class MyYaml

   @@yaml = nil

   def self.yaml
     if @@yaml.nil? then
	@@yaml = File.open(...)
     end
     @@yaml
   end

end

access the yaml file with: MyYaml.yaml

Greetings,

Waldemar