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.



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

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.



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

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.



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

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)


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

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