How to simplify the following check? ...
if node[:base][:database][:adapter].empty? || node[:base][:database][:host].empty? || node[:base][:database][:database].empty? || node[:base][:database][:port].empty?
to something like
required_keys = { :adapter, :host, :database...etc...} required keys - node[:base][:database] == []
This syntax does not work a bit, but basically subtracts the keys from the set of necessary keys. If you have all the necessary keys in your set, the result should be empty.
I'm not sure about the correct syntax ?, Any help would be appreciated
source share