Class: Synqa::FileContent
- Inherits:
-
Object
- Object
- Synqa::FileContent
- Defined in:
- lib/synqa.rb
Overview
An object representing the content of a file within a ContentTree. The file may be marked for copying (if it’s in a source ContentTree) or for deletion (if it’s in a destination ContentTree)
Instance Attribute Summary collapse
-
#copyDestination ⇒ Object
readonly
The destination to which the file should be copied.
-
#hash ⇒ Object
readonly
The hash value of the file’s contents.
-
#name ⇒ Object
readonly
The name of the file.
-
#parentPathElements ⇒ Object
readonly
The components of the relative path where the file is found.
-
#toBeDeleted ⇒ Object
readonly
Should this file be deleted.
Instance Method Summary collapse
-
#initialize(name, hash, parentPathElements) ⇒ FileContent
constructor
A new instance of FileContent.
-
#markToCopy(destinationDirectory) ⇒ Object
Mark this file to be copied to a destination directory (from a destination content tree).
-
#markToDelete ⇒ Object
Mark this file to be deleted.
-
#relativePath ⇒ Object
The relative name of this file in the content tree (relative to the base dir).
- #to_s ⇒ Object
Constructor Details
#initialize(name, hash, parentPathElements) ⇒ FileContent
Returns a new instance of FileContent.
397 398 399 400 401 402 403 |
# File 'lib/synqa.rb', line 397 def initialize(name, hash, parentPathElements) @name = name @hash = hash @parentPathElements = parentPathElements @copyDestination = nil @toBeDeleted = false end |
Instance Attribute Details
#copyDestination ⇒ Object (readonly)
The destination to which the file should be copied
392 393 394 |
# File 'lib/synqa.rb', line 392 def copyDestination @copyDestination end |
#hash ⇒ Object (readonly)
The hash value of the file’s contents
386 387 388 |
# File 'lib/synqa.rb', line 386 def hash @hash end |
#name ⇒ Object (readonly)
The name of the file
383 384 385 |
# File 'lib/synqa.rb', line 383 def name @name end |
#parentPathElements ⇒ Object (readonly)
The components of the relative path where the file is found
389 390 391 |
# File 'lib/synqa.rb', line 389 def parentPathElements @parentPathElements end |
#toBeDeleted ⇒ Object (readonly)
Should this file be deleted
395 396 397 |
# File 'lib/synqa.rb', line 395 def toBeDeleted @toBeDeleted end |
Instance Method Details
#markToCopy(destinationDirectory) ⇒ Object
Mark this file to be copied to a destination directory (from a destination content tree)
406 407 408 |
# File 'lib/synqa.rb', line 406 def markToCopy(destinationDirectory) @copyDestination = destinationDirectory end |
#markToDelete ⇒ Object
Mark this file to be deleted
411 412 413 |
# File 'lib/synqa.rb', line 411 def markToDelete @toBeDeleted = true end |
#relativePath ⇒ Object
The relative name of this file in the content tree (relative to the base dir)
420 421 422 |
# File 'lib/synqa.rb', line 420 def relativePath return (parentPathElements + [name]).join("/") end |
#to_s ⇒ Object
415 416 417 |
# File 'lib/synqa.rb', line 415 def to_s return "#{name} (#{hash})" end |