From d9b78c4e1fb1ffeeca4e6e074a21475c2d013b62 Mon Sep 17 00:00:00 2001 From: Matt Rogers Date: Mon, 2 Nov 2015 22:05:29 -0600 Subject: [PATCH] Simplify the return values when using basic auth Returning a hash with explicit keys isn't strictly necessary with the access methods we're using to get the values for those keys out of the hash. Return an empty hash instead, simplifying the code. Also remove the early return statements within the conditional. Those are also unneeded since this is the last expression that's run in the method. --- lib/login_system.rb | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/lib/login_system.rb b/lib/login_system.rb index f2f97f9d..52978f4a 100644 --- a/lib/login_system.rb +++ b/lib/login_system.rb @@ -195,15 +195,12 @@ module LoginSystem end if authdata and authdata[0] == 'Basic' data = Base64.decode64(authdata[1]).split(':')[0..1] - return { + { user: data[0], pass: data[1] } else - return { - user: ''.freeze, - pass: ''.freeze - } + {} end end