allows :in, :within, :range validations to be used on Array params
This makes it possible to support situations such as
param :sort_by, Array, in: ['id ASC, 'id DESC, 'name ASC', 'name DESC']
Range checks against array elements are also supported, but currently require you to coerce the Array elements manually first:
param :arg, Array, within: 1..10, transform: ->(a) { a.map(&:to_i) }
Thank you for this, @janfoeh. I apologize for the delay in getting back to you.
sinatra-param borrows a lot of its conventions from Active Model validations in Rails. I'd thought that the Rails counterpart to our inclusion check was member to collection, but it looks like it indeed supports member-wise checks for enumerable values as well. As such, this suggested feature would fix sinatra-param to be more in line with expected behavior.
I'm investigating some significant refactoring for the next major release, but would like to incorporate this functionality in the process.
@mattt any chance this will get incorporated?