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 465 def initialize(type, logical_type=nil) 466 if PRIMITIVE_TYPES_SYM.include?(type) 467 super(type, logical_type) 468 elsif PRIMITIVE_TYPES.include?(type) 469 super(type.to_sym, logical_type) 470 else 471 raise AvroError.new("#{type} is not a valid primitive type.") 472 end 473 end
Public Instance Methods
match_schema?(schema)
click to toggle source
# File lib/avro/schema.rb 480 def match_schema?(schema) 481 return type_sym == schema.type_sym 482 # TODO: eventually this could handle schema promotion for primitive schemas too 483 end
to_avro(names=nil)
click to toggle source
Calls superclass method
Avro::Schema#to_avro
# File lib/avro/schema.rb 475 def to_avro(names=nil) 476 hsh = super 477 hsh.size == 1 ? type : hsh 478 end