Class: Avromatic::Model::Types::NullType
- Inherits:
-
AbstractType
- Object
- AbstractType
- Avromatic::Model::Types::NullType
- Defined in:
- lib/avromatic/model/types/null_type.rb
Constant Summary collapse
- VALUE_CLASSES =
[::NilClass].freeze
Instance Method Summary collapse
- #coerce(input) ⇒ Object
- #coercible?(input) ⇒ Boolean (also: #coerced?)
- #name ⇒ Object
- #referenced_model_classes ⇒ Object
- #serialize(_value, _strict) ⇒ Object
- #value_classes ⇒ Object
Methods inherited from AbstractType
Instance Method Details
#coerce(input) ⇒ Object
19 20 21 22 23 24 25 |
# File 'lib/avromatic/model/types/null_type.rb', line 19 def coerce(input) if input.nil? nil else raise ArgumentError.new("Could not coerce '#{input.inspect}' to #{name}") end end |
#coercible?(input) ⇒ Boolean Also known as: coerced?
27 28 29 |
# File 'lib/avromatic/model/types/null_type.rb', line 27 def coercible?(input) input.nil? end |
#name ⇒ Object
15 16 17 |
# File 'lib/avromatic/model/types/null_type.rb', line 15 def name 'null' end |
#referenced_model_classes ⇒ Object
37 38 39 |
# File 'lib/avromatic/model/types/null_type.rb', line 37 def referenced_model_classes EMPTY_ARRAY end |
#serialize(_value, _strict) ⇒ Object
33 34 35 |
# File 'lib/avromatic/model/types/null_type.rb', line 33 def serialize(_value, _strict) nil end |
#value_classes ⇒ Object
11 12 13 |
# File 'lib/avromatic/model/types/null_type.rb', line 11 def value_classes VALUE_CLASSES end |