Class: Avromatic::Model::Types::BigIntType
- Inherits:
-
AbstractType
- Object
- AbstractType
- Avromatic::Model::Types::BigIntType
- Defined in:
- lib/avromatic/model/types/big_int_type.rb
Constant Summary collapse
- VALUE_CLASSES =
[::Integer].freeze
- MAX_RANGE =
2**63
Class Method Summary collapse
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
Class Method Details
Instance Method Details
#coerce(input) ⇒ Object
25 26 27 28 29 30 31 |
# File 'lib/avromatic/model/types/big_int_type.rb', line 25 def coerce(input) if coercible?(input) input else raise ArgumentError.new("Could not coerce '#{input.inspect}' to #{name}") end end |
#coercible?(input) ⇒ Boolean Also known as: coerced?
33 34 35 |
# File 'lib/avromatic/model/types/big_int_type.rb', line 33 def coercible?(input) input.nil? || self.class.in_range?(input) end |
#name ⇒ Object
21 22 23 |
# File 'lib/avromatic/model/types/big_int_type.rb', line 21 def name 'bigint' end |
#referenced_model_classes ⇒ Object
43 44 45 |
# File 'lib/avromatic/model/types/big_int_type.rb', line 43 def referenced_model_classes EMPTY_ARRAY end |
#serialize(value, _strict) ⇒ Object
39 40 41 |
# File 'lib/avromatic/model/types/big_int_type.rb', line 39 def serialize(value, _strict) value end |
#value_classes ⇒ Object
17 18 19 |
# File 'lib/avromatic/model/types/big_int_type.rb', line 17 def value_classes VALUE_CLASSES end |