Module: AvroTurf::AvroGemPatch::Field

Defined in:
lib/avro_turf/schema_to_avro_patch.rb

Instance Method Summary collapse

Instance Method Details

#initialize(type, name, default = :no_default, order = nil, names = nil, namespace = nil) ⇒ Object



26
27
28
# File 'lib/avro_turf/schema_to_avro_patch.rb', line 26

def initialize(type, name, default=:no_default, order=nil, names=nil, namespace=nil)
  super(type, name, default, order, names, namespace)
end

#to_avro(names = Set.new) ⇒ Object



30
31
32
33
34
35
# File 'lib/avro_turf/schema_to_avro_patch.rb', line 30

def to_avro(names=Set.new)
  {'name' => name, 'type' => type.to_avro(names)}.tap do |avro|
    avro['default'] = default unless default == :no_default
    avro['order'] = order if order
  end
end