mutations icon indicating copy to clipboard operation
mutations copied to clipboard

How to handle multiple types

Open aliceclv opened this issue 2 years ago • 1 comments

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

aliceclv avatar Mar 22 '22 10:03 aliceclv

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.

MyklClason avatar May 19 '22 21:05 MyklClason