Sha256: fb32356c878e347e06c9a56efb7fbc555dd9b6d425c4d106fd10828eef19e474

Contents?: true

Size: 718 Bytes

Versions: 1

Compression:

Stored size: 718 Bytes

Contents

module ServiceContract
  module Avro
    class Parameter < AbstractParameter
      def name
        definition.name
      end

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

      def subtype
        item = definition.type.is_a?(::Avro::Schema::ArraySchema) ?
                definition.type.items :
                nil
        return nil unless item

        item.is_a?(::Avro::Schema::PrimitiveSchema) ?
          item.type_sym.to_s :
          item
      end

      def default
        definition.default
      end

      def doc
        definition.respond_to?(:doc) ? definition.doc : nil
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
service_contract-0.0.7 lib/service_contract/avro/parameter.rb