summaryrefslogtreecommitdiff
path: root/lib/byteback/backup_directory.rb
diff options
context:
space:
mode:
authorPatrick J Cherry <patrick@bytemark.co.uk>2017-01-31 12:12:23 +0000
committerPatrick J Cherry <patrick@bytemark.co.uk>2017-01-31 12:12:23 +0000
commit659a651aa294c335e519b4c72bbd052b3199a793 (patch)
treea36a95dd652717624034c553bf18c7d66156ccf5 /lib/byteback/backup_directory.rb
parent38c89a9e32a67f96b40d756a5c356f8c31247ab9 (diff)
First pass with rubocoprubocop
Diffstat (limited to 'lib/byteback/backup_directory.rb')
-rw-r--r--lib/byteback/backup_directory.rb14
1 files changed, 6 insertions, 8 deletions
diff --git a/lib/byteback/backup_directory.rb b/lib/byteback/backup_directory.rb
index a39cf84..8c0521b 100644
--- a/lib/byteback/backup_directory.rb
+++ b/lib/byteback/backup_directory.rb
@@ -3,7 +3,6 @@ require 'byteback/utils'
module Byteback
# Represents a particular timestamped backup directory
class Snapshot
-
include Byteback::Util
class << self
@@ -12,10 +11,10 @@ module Byteback
# Order backups by their closeness to defined backup times, which are
# listed in a set order (i.e. today's backup is more important than yesterday's).
#
- BACKUP_IMPORTANCE = [1, 2, 7, 14, 21, 28, 56, 112]
+ BACKUP_IMPORTANCE = [1, 2, 7, 14, 21, 28, 56, 112].freeze
def sort_by_importance(snapshots_unsorted, now = Time.now)
- return snapshots_unsorted if snapshots_unsorted.size < 1
+ return snapshots_unsorted if snapshots_unsorted.size < 1
#
# Keep the last 7 days backups
@@ -78,11 +77,10 @@ module Byteback
# host was more recent, i.e. we've reached the oldest, and are
# bouncing back again.
#
- if last_nearest[host].nil? || last_nearest[host].time > nearest.time
- last_nearest[host] = nearest
- snapshots_by_host[host] -= [nearest]
- snapshots_sorted << nearest
- end
+ next unless last_nearest[host].nil? || last_nearest[host].time > nearest.time
+ last_nearest[host] = nearest
+ snapshots_by_host[host] -= [nearest]
+ snapshots_sorted << nearest
end
end