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 326 def initialize(type, logical_type=nil) 327 if PRIMITIVE_TYPES_SYM.include?(type) 328 super(type, logical_type) 329 elsif PRIMITIVE_TYPES.include?(type) 330 super(type.to_sym, logical_type) 331 else 332 raise AvroError.new("#{type} is not a valid primitive type.") 333 end 334 end
Public Instance Methods
to_avro(names=nil)
click to toggle source
Calls superclass method
Avro::Schema#to_avro
# File lib/avro/schema.rb 336 def to_avro(names=nil) 337 hsh = super 338 hsh.size == 1 ? type : hsh 339 end