Module: Candid::Internal::Types::Type Abstract
- Includes:
- JSON::Serializable
- Defined in:
- lib/candid/internal/types/type.rb
Overview
This module is abstract.
Instance Method Summary collapse
-
#coerce(value, strict: strict?) ) ⇒ Object
Coerces a value to this type.
-
#strict! ⇒ void
Enable strictness by default for this type.
-
#strict? ⇒ Boolean
Returns if strictness is on for this type, defaults to ‘false`.
Methods included from JSON::Serializable
Instance Method Details
#coerce(value, strict: strict?) ) ⇒ Object
Coerces a value to this type
14 15 16 |
# File 'lib/candid/internal/types/type.rb', line 14 def coerce(value, strict: strict?) raise NotImplementedError end |
#strict! ⇒ void
This method returns an undefined value.
Enable strictness by default for this type
28 29 30 31 |
# File 'lib/candid/internal/types/type.rb', line 28 def strict! @strict = true self end |
#strict? ⇒ Boolean
Returns if strictness is on for this type, defaults to ‘false`
21 22 23 |
# File 'lib/candid/internal/types/type.rb', line 21 def strict? @strict ||= false end |