Built-in Types
Built-in types are grouped under 6 categories:
definition- base type definitions with primitive class and optionsstrict- constrained types with a primitive type check applied to inputcoercible- types with constructors using kernel coercionsparams- types with constructors performing non-strict coercions specific to HTTP paramsjson- types with constructors performing non-strict coercions specific to JSONmaybe- types accepting either nil or a specific primitive type
Categories
Assuming you included types in a module called Types:
Base definitions:
Types::AnyTypes::NilTypes::SymbolTypes::ClassTypes::TrueTypes::FalseTypes::BoolTypes::IntegerTypes::FloatTypes::DecimalTypes::StringTypes::DateTypes::DateTimeTypes::TimeTypes::ArrayTypes::Hash
Stricttypes will raise an error if passed a value of the wrong type:Types::Strict::NilTypes::Strict::SymbolTypes::Strict::ClassTypes::Strict::TrueTypes::Strict::FalseTypes::Strict::BoolTypes::Strict::IntegerTypes::Strict::FloatTypes::Strict::DecimalTypes::Strict::StringTypes::Strict::DateTypes::Strict::DateTimeTypes::Strict::TimeTypes::Strict::ArrayTypes::Strict::Hash
Coercibletypes will attempt to cast values to the correct class using kernel coercion methods:Types::Coercible::StringTypes::Coercible::IntegerTypes::Coercible::FloatTypes::Coercible::DecimalTypes::Coercible::ArrayTypes::Coercible::Hash
Types suitable for
Paramsparam processing with coercions:Types::Params::NilTypes::Params::DateTypes::Params::DateTimeTypes::Params::TimeTypes::Params::TrueTypes::Params::FalseTypes::Params::BoolTypes::Params::IntegerTypes::Params::FloatTypes::Params::DecimalTypes::Params::ArrayTypes::Params::Hash
Types suitable for
JSONprocessing with coercions:Types::JSON::NilTypes::JSON::DateTypes::JSON::DateTimeTypes::JSON::TimeTypes::JSON::DecimalTypes::JSON::ArrayTypes::JSON::Hash
Maybestrict types:Types::Maybe::Strict::ClassTypes::Maybe::Strict::StringTypes::Maybe::Strict::SymbolTypes::Maybe::Strict::TrueTypes::Maybe::Strict::FalseTypes::Maybe::Strict::IntegerTypes::Maybe::Strict::FloatTypes::Maybe::Strict::DecimalTypes::Maybe::Strict::DateTypes::Maybe::Strict::DateTimeTypes::Maybe::Strict::TimeTypes::Maybe::Strict::ArrayTypes::Maybe::Strict::Hash
Maybecoercible types:Types::Maybe::Coercible::StringTypes::Maybe::Coercible::IntegerTypes::Maybe::Coercible::FloatTypes::Maybe::Coercible::DecimalTypes::Maybe::Coercible::ArrayTypes::Maybe::Coercible::Hash
Maybetypes are not available by default - they must be loaded usingDry::Types.load_extensions(:maybe). See Optional Values for more information.