class Avro::Schema::Field

Attributes

default[R]
name[R]
order[R]
type[R]

Public Class Methods

new(type, name, default=:no_default, order=nil, names=nil, namespace=nil) click to toggle source
    # File lib/avro/schema.rb
362 def initialize(type, name, default=:no_default, order=nil, names=nil, namespace=nil)
363   @type = subparse(type, names, namespace)
364   @name = name
365   @default = default
366   @order = order
367 end

Public Instance Methods

default?() click to toggle source
    # File lib/avro/schema.rb
369 def default?
370   @default != :no_default
371 end
to_avro(names=Set.new) click to toggle source
    # File lib/avro/schema.rb
373 def to_avro(names=Set.new)
374   {'name' => name, 'type' => type.to_avro(names)}.tap do |avro|
375     avro['default'] = default if default?
376     avro['order'] = order if order
377   end
378 end