Class: Fig::WorkingDirectoryMetadata

Inherits:
Object
  • Object
show all
Defined in:
lib/fig/working_directory_metadata.rb

Overview

Data about a package within the current working directory.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(package_name, current_version = nil) ⇒ WorkingDirectoryMetadata

Returns a new instance of WorkingDirectoryMetadata.



11
12
13
14
15
16
# File 'lib/fig/working_directory_metadata.rb', line 11

def initialize(package_name, current_version = nil)
  @package_name    = package_name
  @retrieved       = false

  reset_with_version(current_version)
end

Instance Attribute Details

#current_versionObject (readonly)

Returns the value of attribute current_version.



9
10
11
# File 'lib/fig/working_directory_metadata.rb', line 9

def current_version
  @current_version
end

#package_nameObject (readonly)

Returns the value of attribute package_name.



9
10
11
# File 'lib/fig/working_directory_metadata.rb', line 9

def package_name
  @package_name
end

Instance Method Details

#add_file(file) ⇒ Object



25
26
27
28
29
# File 'lib/fig/working_directory_metadata.rb', line 25

def add_file(file)
  @files << file

  return
end

#each_fileObject

So we don’t have to expose the files collection.



42
43
44
45
46
# File 'lib/fig/working_directory_metadata.rb', line 42

def each_file()
  @files.each {|file| yield file}

  return
end

#mark_as_retrievedObject



31
32
33
34
35
# File 'lib/fig/working_directory_metadata.rb', line 31

def mark_as_retrieved()
  @retrieved = true

  return
end

#reset_with_version(new_version) ⇒ Object



18
19
20
21
22
23
# File 'lib/fig/working_directory_metadata.rb', line 18

def reset_with_version(new_version)
  @current_version = new_version
  @files           = Set.new

  return
end

#retrieved?Boolean

Returns:

  • (Boolean)


37
38
39
# File 'lib/fig/working_directory_metadata.rb', line 37

def retrieved?()
  return @retrieved
end