mirror of
https://github.com/inspec/inspec
synced 2024-11-23 21:23:29 +00:00
simplify nested params retrieval
Signed-off-by: Dominik Richter <dominik.richter@gmail.com>
This commit is contained in:
parent
55a26cfba7
commit
dcc790b8a9
1 changed files with 2 additions and 4 deletions
|
@ -23,11 +23,9 @@ class SshConf < Vulcano.resource(1)
|
||||||
end
|
end
|
||||||
|
|
||||||
def params(*opts)
|
def params(*opts)
|
||||||
res = @params
|
opts.inject(read_params) do |cur, acc|
|
||||||
opts.each do |opt|
|
cur.respond_to?(:key) ? cur[acc] : nil
|
||||||
res = res[opt] unless res.nil?
|
|
||||||
end
|
end
|
||||||
res
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def method_missing(name)
|
def method_missing(name)
|
||||||
|
|
Loading…
Reference in a new issue