Class: Farce::Internal::DryTypes::AtomType
- Inherits:
-
CollectionType
- Object
- CollectionType
- Farce::Internal::DryTypes::AtomType
- Defined in:
- lib/farce/integrations/dry_types.rb
Overview
An Atom type that validates or coerces its initial contents.
Instance Attribute Summary
Attributes inherited from CollectionType
Dry Types Integration collapse
-
#of(value_type) ⇒ AtomType
Apply a dry type to the initial value before Atom construction.
Methods inherited from CollectionType
#call, #constrained?, #default?, #inspect, #meta, #name, #optional?, #primitive?, #pristine, #to_ast, #to_proc, #try, #valid?, #with
Instance Method Details
#of(value_type) ⇒ AtomType
Apply a dry type to the initial value before Atom construction.
Later writes use the ordinary Farce Atom API and are not checked by this type.
327 328 329 330 331 |
# File 'lib/farce/integrations/dry_types.rb', line 327 def of(value_type) raise ArgumentError, "Atom.of requires a dry type" unless value_type.is_a?(::Dry::Types::Type) self.class.new(value_type, kind:, configuration:) end |