dry-types

v1.8 v1.7
  1. Introduction
  2. Getting Started
  3. Built-in Types
  4. Type Attributes
  5. Default Values
  6. Fallbacks
  7. Constraints
  8. Hash Schemas
  9. Array With Member
  10. Enum
  11. Map
  12. Combining Types
    1. Intersection
    2. Sum
  13. Custom Types
  14. Custom Type Builders
  15. Extensions
    1. Maybe
    2. Monads

TOC

  1. Categories

Built-in Types

Built-in types are grouped under 6 categories:

Categories

Assuming you included Dry::Types (see instructions) in a module called Types:

All types in the strict category are constrained by a type-check that is applied to make sure that the input is an instance of the primitive:

Types::Strict::Integer[1] # => 1
Types::Strict::Integer['1'] # => raises Dry::Types::ConstraintError

Maybe types are not available by default - they must be loaded using Dry::Types.load_extensions(:maybe). See Maybe extension for more information.