Class: Bard::Backup::Deleter
- Inherits:
-
Struct
- Object
- Struct
- Bard::Backup::Deleter
- Defined in:
- lib/bard/backup/deleter.rb
Defined Under Namespace
Classes: Filter
Instance Attribute Summary collapse
-
#now ⇒ Object
Returns the value of attribute now.
-
#s3_dir ⇒ Object
Returns the value of attribute s3_dir.
Instance Method Summary collapse
Instance Attribute Details
#now ⇒ Object
Returns the value of attribute now
7 8 9 |
# File 'lib/bard/backup/deleter.rb', line 7 def now @now end |
#s3_dir ⇒ Object
Returns the value of attribute s3_dir
7 8 9 |
# File 'lib/bard/backup/deleter.rb', line 7 def s3_dir @s3_dir end |
Instance Method Details
#call ⇒ Object
8 9 10 |
# File 'lib/bard/backup/deleter.rb', line 8 def call s3_dir.delete files_to_delete end |
#files_to_delete ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/bard/backup/deleter.rb', line 12 def files_to_delete s3_dir.files.select do |file| [ Filter.new(now, 72, :hours), Filter.new(now, 60, :days), Filter.new(now, 52, :weeks), Filter.new(now, 48, :months), Filter.new(now, 100, :years), ].all? { |filter| !filter.cover?(file) } end end |