Class: TaskJuggler::FileList

Inherits:
Object
  • Object
show all
Defined in:
lib/taskjuggler/FileList.rb

Overview

The FileList class stores a list of file names. Each file name is unique and more information about the file is contained in FileRecord entries.

Instance Method Summary collapse

Constructor Details

#initializeFileList

Create a new, empty FileList.



36
37
38
# File 'lib/taskjuggler/FileList.rb', line 36

def initialize
  @files = {}
end

Instance Method Details

#<<(fileName) ⇒ Object

Add the file with fileName to the list. If it’s already in the list, it will not be added again.



42
43
44
45
46
# File 'lib/taskjuggler/FileList.rb', line 42

def <<(fileName)
  return if fileName == '.' || @files.include?(fileName)

  @files[fileName] = FileRecord.new(fileName)
end

#masterFileObject

Return the name of the master file or nil of the master file was stdin.



49
50
51
52
53
54
55
# File 'lib/taskjuggler/FileList.rb', line 49

def masterFile
  @files.each_key do |file|
    return file if file[-4, 4] == '.tjp'
  end

  nil
end

#modified?Boolean

Return true if any of the files in the list have been modified after they were added to the list.

Returns:

  • (Boolean)


59
60
61
62
63
64
# File 'lib/taskjuggler/FileList.rb', line 59

def modified?
  @files.each_value do |f|
    return true if f.modified?
  end
  false
end