Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def nested_present?(duck)
- if duck.respond_to(:values)
- nested_present?(duck.values)
- elsif duck.respond_to? :any?
- duck.any? { |duckling| nested_present? duckling }
- else
- duck.present?
- end
- end
Add Comment
Please, Sign In to add comment