summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnders Carling <lowe@lowe.nu>2019-10-31 03:16:02 +0100
committerAnders Carling <lowe@lowe.nu>2019-10-31 03:16:02 +0100
commitf99ba4c04b16f7078f56e709cd67f31ed8a4a325 (patch)
tree02fa67e372e7b71216d8910cebf999b96e05a2e0
parent2e922251541ddcb69763e279049d7eb01a98369e (diff)
downloadnet-ssh-f99ba4c04b16f7078f56e709cd67f31ed8a4a325.tar.gz
Reduce number of lines in method to satisfy rubocop
-rw-r--r--lib/net/ssh/config.rb42
1 files changed, 21 insertions, 21 deletions
diff --git a/lib/net/ssh/config.rb b/lib/net/ssh/config.rb
index af0cde1..5c81e61 100644
--- a/lib/net/ssh/config.rb
+++ b/lib/net/ssh/config.rb
@@ -197,26 +197,26 @@ module Net
private
+ TRANSLATE_CONFIG_KEY_RENAME_MAP = {
+ bindaddress: :bind_address,
+ compression: :compression,
+ compressionlevel: :compression_level,
+ certificatefile: :keycerts,
+ connecttimeout: :timeout,
+ forwardagent: :forward_agent,
+ identitiesonly: :keys_only,
+ identityagent: :identity_agent,
+ globalknownhostsfile: :global_known_hosts_file,
+ hostkeyalias: :host_key_alias,
+ identityfile: :keys,
+ fingerprinthash: :fingerprint_hash,
+ port: :port,
+ stricthostkeychecking: :strict_host_key_checking,
+ user: :user,
+ userknownhostsfile: :user_known_hosts_file,
+ checkhostip: :check_host_ip
+ }.freeze
def translate_config_key(hash, key, value, settings)
- rename = {
- bindaddress: :bind_address,
- compression: :compression,
- compressionlevel: :compression_level,
- certificatefile: :keycerts,
- connecttimeout: :timeout,
- forwardagent: :forward_agent,
- identitiesonly: :keys_only,
- identityagent: :identity_agent,
- globalknownhostsfile: :global_known_hosts_file,
- hostkeyalias: :host_key_alias,
- identityfile: :keys,
- fingerprinthash: :fingerprint_hash,
- port: :port,
- stricthostkeychecking: :strict_host_key_checking,
- user: :user,
- userknownhostsfile: :user_known_hosts_file,
- checkhostip: :check_host_ip
- }
case key
when :ciphers
hash[:encryption] = value.split(/,/)
@@ -278,8 +278,8 @@ module Net
hash[:send_env] = multi_send_env.map { |e| Regexp.new pattern2regex(e).source, false }
when :numberofpasswordprompts
hash[:number_of_password_prompts] = value.to_i
- when *rename.keys
- hash[rename[key]] = value
+ when *TRANSLATE_CONFIG_KEY_RENAME_MAP.keys
+ hash[TRANSLATE_CONFIG_KEY_RENAME_MAP[key]] = value
end
end