Sha256: d6e0aec704b5e6a96b05aa2415002646e1c1faf0e9f228e88c697a385167b0fc

Contents?: true

Size: 644 Bytes

Versions: 3

Compression:

Stored size: 644 Bytes

Contents

# frozen_string_literal: true

module Avro
  module Builder
    module Types
      class FixedType < NamedType

        dsl_attributes :size, :precision, :scale

        def serialize(reference_state)
          super(reference_state, overrides: serialized_attributes)
        end

        def to_h(reference_state)
          super(reference_state, overrides: serialized_attributes)
        end

        def validate!
          super
          validate_required_attribute!(:size)
        end

        private

        def serialized_attributes
          { size: size, precision: precision, scale: scale }
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
avro-builder-2.1.0 lib/avro/builder/types/fixed_type.rb
avro-builder-2.0.0 lib/avro/builder/types/fixed_type.rb
avro-builder-1.1.0 lib/avro/builder/types/fixed_type.rb