-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Labels
Description
I was using Vert on a json string and wanted to run a specific procedure if the string was an empty JSON object. I hacked a solution using :custom_errors and strings (symbols more specifically) but I would like a more elegant solution included in the library.
I propose adding a :hooks key, which would work similarly to the :custom_errors key but returning whatever was specified in the options hash instead of a string. This would allow you to do very convenient callback handling on your data without setting up case statements, or conditionals.
This is also nice for overriding tests, eg. if you want to accept an empty hash or an empty JSON object as valid data you can add a hook for :empty and :empty_json_object.
Reactions are currently unavailable