Class: Fig::WorkingDirectoryMetadata
- Inherits:
-
Object
- Object
- Fig::WorkingDirectoryMetadata
- Defined in:
- lib/fig/working_directory_metadata.rb
Overview
Data about a package within the current working directory.
Instance Attribute Summary collapse
-
#current_version ⇒ Object
readonly
Returns the value of attribute current_version.
-
#package_name ⇒ Object
readonly
Returns the value of attribute package_name.
Instance Method Summary collapse
- #add_file(file) ⇒ Object
-
#each_file ⇒ Object
So we don’t have to expose the files collection.
-
#initialize(package_name, current_version = nil) ⇒ WorkingDirectoryMetadata
constructor
A new instance of WorkingDirectoryMetadata.
- #mark_as_retrieved ⇒ Object
- #reset_with_version(new_version) ⇒ Object
- #retrieved? ⇒ Boolean
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_version ⇒ Object (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_name ⇒ Object (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_file ⇒ Object
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_retrieved ⇒ Object
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
37 38 39 |
# File 'lib/fig/working_directory_metadata.rb', line 37 def retrieved?() return @retrieved end |