Class: Longleaf::FileRecord
- Inherits:
-
Object
- Object
- Longleaf::FileRecord
- Defined in:
- lib/longleaf/models/file_record.rb
Overview
Record for an individual file and its associated information
Instance Attribute Summary collapse
-
#metadata_record ⇒ Object
Returns the value of attribute metadata_record.
-
#path ⇒ Object
readonly
Returns the value of attribute path.
-
#storage_location ⇒ Object
readonly
Returns the value of attribute storage_location.
Instance Method Summary collapse
- #==(other_obj) ⇒ Object
-
#initialize(file_path, storage_location, metadata_record = nil) ⇒ FileRecord
constructor
A new instance of FileRecord.
-
#metadata_path ⇒ String
Path for the metadata file for this file.
- #metadata_present? ⇒ Boolean
Constructor Details
#initialize(file_path, storage_location, metadata_record = nil) ⇒ FileRecord
Returns a new instance of FileRecord.
10 11 12 13 14 15 16 17 |
# File 'lib/longleaf/models/file_record.rb', line 10 def initialize(file_path, storage_location, = nil) raise ArgumentError.new("FileRecord requires a path") if file_path.nil? raise ArgumentError.new("FileRecord requires a storage_location") if storage_location.nil? @path = file_path @storage_location = storage_location @metadata_record = end |
Instance Attribute Details
#metadata_record ⇒ Object
Returns the value of attribute metadata_record.
4 5 6 |
# File 'lib/longleaf/models/file_record.rb', line 4 def @metadata_record end |
#path ⇒ Object (readonly)
Returns the value of attribute path.
6 7 8 |
# File 'lib/longleaf/models/file_record.rb', line 6 def path @path end |
#storage_location ⇒ Object (readonly)
Returns the value of attribute storage_location.
5 6 7 |
# File 'lib/longleaf/models/file_record.rb', line 5 def storage_location @storage_location end |
Instance Method Details
#==(other_obj) ⇒ Object
29 30 31 32 |
# File 'lib/longleaf/models/file_record.rb', line 29 def ==(other_obj) return false unless other_obj.is_a?(FileRecord) path == other_obj.path end |
#metadata_path ⇒ String
Returns path for the metadata file for this file.
20 21 22 23 |
# File 'lib/longleaf/models/file_record.rb', line 20 def @metadata_path = @storage_location.(path) if @metadata_path.nil? @metadata_path end |
#metadata_present? ⇒ Boolean
25 26 27 |
# File 'lib/longleaf/models/file_record.rb', line 25 def File.exist?() end |