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



28
29
30
# File 'lib/avro_turf/schema_to_avro_patch.rb', line 28

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

#to_avro(names = Set.new) ⇒ Object



32
33
34
35
36
37
# File 'lib/avro_turf/schema_to_avro_patch.rb', line 32

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