simplify nested params retrieval

Signed-off-by: Dominik Richter <dominik.richter@gmail.com>
This commit is contained in:
Dominik Richter 2015-09-17 17:04:05 +02:00
parent 55a26cfba7
commit dcc790b8a9

View file

@ -23,11 +23,9 @@ class SshConf < Vulcano.resource(1)
end
def params(*opts)
res = @params
opts.each do |opt|
res = res[opt] unless res.nil?
opts.inject(read_params) do |cur, acc|
cur.respond_to?(:key) ? cur[acc] : nil
end
res
end
def method_missing(name)