How to handle multiple types
aliceclv opened this issue Β· comments
Alice commented
How would you normally handle a parameter that has multiple types?
I have a hash, containing a key channel_id
that can be either string
or integer
.
Thanks a lot for your help π !
hash :setup do
integer :channel_id
string :channel_id
end
Mykl Clason commented
If it's an integer in a stringformat just use integer. Otherwise take a look at this page:
https://github.com/cypriss/mutations/wiki/Filtering-Input
Alternatively, you may need to add your own custom type, would be nice if the docs included how to go about that though without digging into the codebase.