Module: Backup::S3Helper
- Included in:
- S3
- Defined in:
- lib/capistrano/ops/rails/lib/backup/s3_helper.rb
Instance Method Summary collapse
- #get_current_month(all_items) ⇒ Object
- #get_delete_items(items, keep) ⇒ Object
- #get_items_by_month(all_items, month) ⇒ Object
- #get_months(all_items) ⇒ Object
- #get_old_months(months) ⇒ Object
Instance Method Details
#get_current_month(all_items) ⇒ Object
17 18 19 |
# File 'lib/capistrano/ops/rails/lib/backup/s3_helper.rb', line 17 def get_current_month(all_items) all_items.select { |item| item[:last_modified].strftime('%Y-%m') == Time.now.strftime('%Y-%m') } end |
#get_delete_items(items, keep) ⇒ Object
5 6 7 |
# File 'lib/capistrano/ops/rails/lib/backup/s3_helper.rb', line 5 def get_delete_items(items, keep) items.slice(keep..-1) end |
#get_items_by_month(all_items, month) ⇒ Object
21 22 23 |
# File 'lib/capistrano/ops/rails/lib/backup/s3_helper.rb', line 21 def get_items_by_month(all_items, month) all_items.select { |item| item[:last_modified].strftime('%Y-%m') == month } end |
#get_months(all_items) ⇒ Object
9 10 11 |
# File 'lib/capistrano/ops/rails/lib/backup/s3_helper.rb', line 9 def get_months(all_items) all_items.reverse.map { |m| m[:last_modified].strftime('%Y-%m') } end |
#get_old_months(months) ⇒ Object
13 14 15 |
# File 'lib/capistrano/ops/rails/lib/backup/s3_helper.rb', line 13 def get_old_months(months) months.uniq.reject { |m| m == Time.now.strftime('%Y-%m') } end |