diff options
| author | mokha <mokha@cisco.com> | 2018-05-14 18:43:54 -0600 |
|---|---|---|
| committer | mokha <mokha@cisco.com> | 2018-05-14 18:43:54 -0600 |
| commit | dd2d2d91a151435ed27f9c8167667251fe6ac489 (patch) | |
| tree | 22dcf7672e58b3c3caac2d5e359cf6db3c7f3714 /lib | |
| parent | 98c25e3240346fe91f8de46bb05f93894a484002 (diff) | |
inline conditional.
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/net/hippie/client.rb | 10 |
1 files 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 |
