From 1df51bd2c3a3ee53834c89a074e56c361b051460 Mon Sep 17 00:00:00 2001 From: Jamie Nguyen Date: Wed, 11 May 2016 08:28:06 +0100 Subject: Prevent accumulator from being set to Nil --- bin/byteback-receive | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/byteback-receive b/bin/byteback-receive index 0d7d025..1326bba 100755 --- a/bin/byteback-receive +++ b/bin/byteback-receive @@ -116,7 +116,7 @@ end # Make sure we don't get crazy option combinations. # n_modes = opts.keys.inject(0) do |s,m| - s += 1 if [:ping, :complete, :list].include?(m) + [:ping, :complete, :list].include?(m) ? s += 1 : s end error('Please only choose one mode') unless n_modes == 1 -- cgit v1.2.1 From acc0d316c9dd628e3e2d6be438de83b6d7cf6638 Mon Sep 17 00:00:00 2001 From: Jamie Nguyen Date: Wed, 11 May 2016 08:30:04 +0100 Subject: Avoid chaining over a newline --- lib/byteback/backup_directory.rb | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/lib/byteback/backup_directory.rb b/lib/byteback/backup_directory.rb index 14a55cf..89b0ae9 100644 --- a/lib/byteback/backup_directory.rb +++ b/lib/byteback/backup_directory.rb @@ -150,8 +150,7 @@ module Byteback next if entry[0] == '.' name = File.expand_path(ENV['HOME'] + '/' + entry) File.directory?(name + '/current') ? BackupDirectory.new(name) : nil - end - .compact + end.compact end # Returns every snapshot in every backup directory @@ -190,8 +189,7 @@ module Byteback # directory name must represent a parseable Time nil end - end - .compact + end.compact end # Create a new snapshot of 'current' -- cgit v1.2.1