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
-
#fullPath ⇒ Object
The full (relative) name of this file in the content tree.
-
#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.
- #to_s ⇒ Object
Constructor Details
#initialize(name, hash, parentPathElements) ⇒ FileContent
Returns a new instance of FileContent.
285 286 287 288 289 290 291 |
# File 'lib/synqa.rb', line 285 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
280 281 282 |
# File 'lib/synqa.rb', line 280 def copyDestination @copyDestination end |
#hash ⇒ Object (readonly)
The hash value of the file’s contents
274 275 276 |
# File 'lib/synqa.rb', line 274 def hash @hash end |
#name ⇒ Object (readonly)
The name of the file
271 272 273 |
# File 'lib/synqa.rb', line 271 def name @name end |
#parentPathElements ⇒ Object (readonly)
The components of the relative path where the file is found
277 278 279 |
# File 'lib/synqa.rb', line 277 def parentPathElements @parentPathElements end |
#toBeDeleted ⇒ Object (readonly)
Should this file be deleted
283 284 285 |
# File 'lib/synqa.rb', line 283 def toBeDeleted @toBeDeleted end |
Instance Method Details
#fullPath ⇒ Object
The full (relative) name of this file in the content tree
308 309 310 |
# File 'lib/synqa.rb', line 308 def fullPath return (parentPathElements + [name]).join("/") end |
#markToCopy(destinationDirectory) ⇒ Object
Mark this file to be copied to a destination directory (from a destination content tree)
294 295 296 |
# File 'lib/synqa.rb', line 294 def markToCopy(destinationDirectory) @copyDestination = destinationDirectory end |
#markToDelete ⇒ Object
Mark this file to be deleted
299 300 301 |
# File 'lib/synqa.rb', line 299 def markToDelete @toBeDeleted = true end |
#to_s ⇒ Object
303 304 305 |
# File 'lib/synqa.rb', line 303 def to_s return "#{name} (#{hash})" end |