Sha256: 77c39ff9eadb3803f633a57bfb639508dea33f64ce406bc91a83be2042fc4b3c
Contents?: true
Size: 769 Bytes
Versions: 5
Compression:
Stored size: 769 Bytes
Contents
# frozen_string_literal: true require 'avromatic/model/types/abstract_type' module Avromatic module Model module Types class IntegerType < AbstractType VALUE_CLASSES = [::Integer].freeze def value_classes VALUE_CLASSES end def name 'integer' end def coerce(input) if input.nil? || input.is_a?(::Integer) input else raise ArgumentError.new("Could not coerce '#{input.inspect}' to #{name}") end end def coercible?(input) input.nil? || input.is_a?(::Integer) end alias_method :coerced?, :coercible? def serialize(value, **) value end end end end end
Version data entries
5 entries across 5 versions & 1 rubygems