diff options
author | Tim Smith <tsmith84@gmail.com> | 2020-11-18 11:06:28 -0800 |
---|---|---|
committer | Tim Smith <tsmith84@gmail.com> | 2020-11-18 11:06:28 -0800 |
commit | a147998274c823d626d4b4e18a2dff53bba90370 (patch) | |
tree | a51803d95e2f9253bdc133ba34d890f1efa004aa | |
parent | 66eadec5e29a2b47259caaa5c425f0897a1f7417 (diff) | |
download | ohai-a147998274c823d626d4b4e18a2dff53bba90370.tar.gz |
Use each_slice to further simplify key/value parsing
Signed-off-by: Tim Smith <tsmith@chef.io>
-rw-r--r-- | lib/ohai/plugins/aix/network.rb | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/lib/ohai/plugins/aix/network.rb b/lib/ohai/plugins/aix/network.rb index 368ccf44..954c919d 100644 --- a/lib/ohai/plugins/aix/network.rb +++ b/lib/ohai/plugins/aix/network.rb @@ -97,9 +97,8 @@ Ohai.plugin(:Network) do # add all key value data into the interface mash # for example "tcp_sendspace 131072 tcp_recvspace 131072 rfc1323 1" # has keys tcp_sendspace, tcp_recvspace, and rfc1323 - properties = line.split - (properties.size / 2).times do - ifaces[int_name][properties.shift] = properties.shift + line.split.each_slice(2) do |key, value| + ifaces[int_name][key] = value end end end |