Class: YOLOBackup::StoragePool::File::Cleaner
- Inherits:
-
Object
- Object
- YOLOBackup::StoragePool::File::Cleaner
- Defined in:
- lib/yolo_backup/storage_pool/file/cleaner.rb
Instance Attribute Summary collapse
-
#server ⇒ Object
readonly
Returns the value of attribute server.
-
#storage_pool ⇒ Object
readonly
Returns the value of attribute storage_pool.
Instance Method Summary collapse
- #cleanup ⇒ Object
-
#initialize(storage_pool, server) ⇒ Cleaner
constructor
A new instance of Cleaner.
Constructor Details
#initialize(storage_pool, server) ⇒ Cleaner
Returns a new instance of Cleaner.
8 9 10 11 |
# File 'lib/yolo_backup/storage_pool/file/cleaner.rb', line 8 def initialize(storage_pool, server) @storage_pool = storage_pool @server = server end |
Instance Attribute Details
#server ⇒ Object (readonly)
Returns the value of attribute server.
6 7 8 |
# File 'lib/yolo_backup/storage_pool/file/cleaner.rb', line 6 def server @server end |
#storage_pool ⇒ Object (readonly)
Returns the value of attribute storage_pool.
6 7 8 |
# File 'lib/yolo_backup/storage_pool/file/cleaner.rb', line 6 def storage_pool @storage_pool end |
Instance Method Details
#cleanup ⇒ Object
13 14 15 16 17 18 19 20 21 |
# File 'lib/yolo_backup/storage_pool/file/cleaner.rb', line 13 def cleanup unused_backups = all_backups - required_backups unused_backups.each do |unused_backup| path = "#{server_path}/#{unused_backup.iso8601}" p path FileUtils.rm_r path, :force => true end unused_backups end |