Sha256: 9627ec5c8c7f2f9a4879fc43460bee9f182d649a77eee7777867913434924710

Contents?: true

Size: 648 Bytes

Versions: 11

Compression:

Stored size: 648 Bytes

Contents

# frozen_string_literal: true

module Backup
  module S3Helper
    def get_delete_items(items, keep)
      items.slice(keep..-1)
    end

    def get_months(all_items)
      all_items.reverse.map { |m| m[:last_modified].strftime('%Y-%m') }
    end

    def get_old_months(months)
      months.uniq.reject { |m| m == Time.now.strftime('%Y-%m') }
    end

    def get_current_month(all_items)
      all_items.select { |item| item[:last_modified].strftime('%Y-%m') == Time.now.strftime('%Y-%m') }
    end

    def get_items_by_month(all_items, month)
      all_items.select { |item| item[:last_modified].strftime('%Y-%m') == month }
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
capistrano-ops-1.0.4 lib/capistrano/ops/rails/lib/backup/s3_helper.rb
capistrano-ops-1.0.3 lib/capistrano/ops/rails/lib/backup/s3_helper.rb
capistrano-ops-1.0.2 lib/capistrano/ops/rails/lib/backup/s3_helper.rb
capistrano-ops-1.0.1 lib/capistrano/ops/rails/lib/backup/s3_helper.rb
capistrano-ops-1.0.0 lib/capistrano/ops/rails/lib/backup/s3_helper.rb
capistrano-ops-0.2.14 lib/capistrano/ops/backup/s3_helper.rb
capistrano-ops-0.2.13 lib/capistrano/ops/backup/s3_helper.rb
capistrano-ops-0.2.12 lib/capistrano/ops/backup/s3_helper.rb
capistrano-ops-0.2.11 lib/capistrano/ops/backup/s3_helper.rb
capistrano-ops-0.2.10 lib/capistrano/ops/backup/s3_helper.rb
capistrano-ops-0.2.9 lib/capistrano/ops/backup/s3_helper.rb