I would like to know if there is any...
Exactly that is what you should check, if there is any of the elements in the block which is true
:
receive_payment_on = config[:sections].any? do |section|
if section[:applicants]
section[:applicants][:sections].any? do |app_sec|
app_sec[:employment] && app_sec[:employment][:receive_payment_on]
end
end
end
In Ruby (or any language with functional capabilities, for that matter) it's not idiomatic to use a imperative loop to do that.