From dd2d2d91a151435ed27f9c8167667251fe6ac489 Mon Sep 17 00:00:00 2001 From: mokha Date: Mon, 14 May 2018 18:43:54 -0600 Subject: inline conditional. --- lib/net/hippie/client.rb | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/lib/net/hippie/client.rb b/lib/net/hippie/client.rb index feb5025..33cc729 100644 --- a/lib/net/hippie/client.rb +++ b/lib/net/hippie/client.rb @@ -77,18 +77,14 @@ module Net uri.is_a?(URI) ? uri : URI.parse(uri) end - def private_key - if passphrase - OpenSSL::PKey::RSA.new(key, passphrase) - else - OpenSSL::PKey::RSA.new(key) - end + def private_key(type = OpenSSL::PKey::RSA) + passphrase ? type.new(key, passphrase) : type.new(key) end def apply_client_tls_to(http) return if certificate.nil? || key.nil? - http.cert = OpenSSL::X509::Certificate.new(certificate) if certificate + http.cert = OpenSSL::X509::Certificate.new(certificate) http.key = private_key end end -- cgit v1.2.3