From: Edward Rawde Date: 2005-12-09T05:47:38+09:00 Subject: Not initialized The class below seems to do exactly what I want it to do provided Files.read_file is called first. But it would be nice not to have to call Files.read_file externally at all and have the other two methods automatically call it once, the first time either of them is used. So far I've not been able to do this without getting "uninitialized class variable" errors. Is there a simple way to do it? I've only been learning Ruby for two days so it's quite possible I've missed the obvious. Ed class Files def Files.read_file @@file = File.open("test.bin","rb") @@code = [] @@address = 0 while @@address < 65536 and (@@byte = @@file.getc) != nil @@code.push(@@byte) @@address += 1 end @@file.close end def Files.readCodeByte index return @@code[index-@@offset] end def Files.setOffset anoffset @@offset = anoffset end end