Class: MRunEnv::RunEnv

Inherits:
Object
  • Object
show all
Defined in:
ext/lib/CompLearnLib/RunEnv.rb

Constant Summary collapse

@@TMPDIR =
"/tmp"

Class Method Summary collapse

Class Method Details

.dirsInDir(dirname) ⇒ Object



40
41
42
43
44
45
46
# File 'ext/lib/CompLearnLib/RunEnv.rb', line 40

def RunEnv.dirsInDir(dirname)
  dirs = [ ]
  for f in Dir.entries(dirname)
    dirs << f if File.ftype(dirname+"/"+f)=='directory' && f != '.' && f != '..'
  end
  dirs.sort
end

.filesInDir(dirname) ⇒ Object



47
48
49
50
51
52
53
# File 'ext/lib/CompLearnLib/RunEnv.rb', line 47

def RunEnv.filesInDir(dirname)
  files = [ ]
  for f in Dir.entries(dirname)
    files << f if File.ftype(dirname+"/"+f)=='file'
  end
  files.sort
end

.getTemporaryFilenameObject



26
27
28
29
30
31
# File 'ext/lib/CompLearnLib/RunEnv.rb', line 26

def RunEnv.getTemporaryFilename()
  fname = format("%s/tmp-%05d.dat", @@TMPDIR, @tmpCounter)
  @tmpCounter += 1
  at_exit { File.exist?(fname) && File.unlink(fname) }
  fname
end

.getTemporaryFilenames(howMany) ⇒ Object



32
33
34
35
36
# File 'ext/lib/CompLearnLib/RunEnv.rb', line 32

def RunEnv.getTemporaryFilenames(howMany)
  results = [ ]
  howMany.times { results << RunEnv.getTemporaryFilename() }
  results
end

.zrand(n) ⇒ Object



37
38
39
# File 'ext/lib/CompLearnLib/RunEnv.rb', line 37

def RunEnv.zrand(n)
  rand(n)
end