Sha256: 4e688d31064ff3052559677573a32c693b73b2c6e509ea17b3dad73076d08ec9

Contents?: true

Size: 674 Bytes

Versions: 2

Compression:

Stored size: 674 Bytes

Contents

module Avro
  module Builder
    module Types

      # This module provides common functionality for non-primitive types
      # that do not require a name to be created.
      module ComplexType

        def self.included(base)
          base.extend ClassMethods
        end

        # Override initialize so that type name is not required
        def initialize
        end

        def type_name
          self.class.type_name
        end

        module ClassMethods

          # Infer type_name based on class
          def type_name
            @type_name ||= name.split('::').last.sub('Type', '').downcase.to_sym
          end
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
avro-builder-0.4.0 lib/avro/builder/types/complex_type.rb
avro-builder-0.3.2 lib/avro/builder/types/complex_type.rb