dry-rb - dry-types


custom types

old way

  1. https://gist.github.com/AMHOL/0671986632fe734189c4c73e2a665f8b
Dry::Types.register_class(User)
param :user, Types::User

new way

  1. http://dry-rb.org/gems/dry-types/custom-types/
  2. http://dry-rb.org/gems/dry-types/array-with-member/
param :user, Types.Instance(User)

array with members of custom type:

param :user, Types::Strict::Array.of(Types.Instance(User))

optional and default values

  1. http://dry-rb.org/gems/dry-types/optional-values
  2. http://dry-rb.org/gems/dry-types/default-values