Sha256: 538602412df2b188b734ca0d21f85afd51ef691fd2d810f847cbf2becf3c20e4

Contents?: true

Size: 544 Bytes

Versions: 3

Compression:

Stored size: 544 Bytes

Contents

module ServiceContract
  module Avro
    class Type < AbstractType
      def name
        definition.name
      end

      def fields
        definition.fields.map do |field|
          Parameter.new(field)
        end
      end

      def to_s
        name
      end

      def self.build(definition)
        definition.is_a?(::Avro::Schema::ArraySchema) ? 
          ArrayType.new(definition) :
          Type.new(definition)
      end

      protected

      def record?
        definition.type.type_sym == :record
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
service_contract-0.0.7 lib/service_contract/avro/type.rb
service_contract-0.0.6 lib/service_contract/avro/type.rb
service_contract-0.0.5 lib/service_contract/avro/type.rb