class Avro::Schema::PrimitiveSchema

Valid primitive types are in PRIMITIVE_TYPES.

Public Class Methods

new(type, logical_type=nil) click to toggle source
Calls superclass method Avro::Schema::new
    # File lib/avro/schema.rb
466 def initialize(type, logical_type=nil)
467   if PRIMITIVE_TYPES_SYM.include?(type)
468     super(type, logical_type)
469   elsif PRIMITIVE_TYPES.include?(type)
470     super(type.to_sym, logical_type)
471   else
472     raise AvroError.new("#{type} is not a valid primitive type.")
473   end
474 end

Public Instance Methods

match_schema?(schema) click to toggle source
    # File lib/avro/schema.rb
481 def match_schema?(schema)
482   return type_sym == schema.type_sym
483   # TODO: eventually this could handle schema promotion for primitive schemas too
484 end
to_avro(names=nil) click to toggle source
Calls superclass method Avro::Schema#to_avro
    # File lib/avro/schema.rb
476 def to_avro(names=nil)
477   hsh = super
478   hsh.size == 1 ? type : hsh
479 end