class Avro::Schema::FixedSchema
Attributes
precision[R]
scale[R]
size[R]
Public Class Methods
new(name, space, size, names=nil, logical_type=nil, aliases=nil, precision=nil, scale=nil)
click to toggle source
Calls superclass method
Avro::Schema::NamedSchema::new
# File lib/avro/schema.rb 532 def initialize(name, space, size, names=nil, logical_type=nil, aliases=nil, precision=nil, scale=nil) 533 # Ensure valid cto args 534 unless size.is_a?(Integer) 535 raise AvroError, 'Fixed Schema requires a valid integer for size property.' 536 end 537 super(:fixed, name, space, names, nil, logical_type, aliases) 538 @size = size 539 @precision = precision 540 @scale = scale 541 end
Public Instance Methods
match_schema?(schema)
click to toggle source
Calls superclass method
Avro::Schema::NamedSchema#match_schema?
# File lib/avro/schema.rb 553 def match_schema?(schema) 554 return true if super && size == schema.size 555 556 if logical_type == DECIMAL_LOGICAL_TYPE && schema.logical_type == DECIMAL_LOGICAL_TYPE 557 return precision == schema.precision && (scale || 0) == (schema.scale || 0) 558 end 559 560 false 561 end
to_avro(names=Set.new)
click to toggle source
Calls superclass method
Avro::Schema::NamedSchema#to_avro
# File lib/avro/schema.rb 543 def to_avro(names=Set.new) 544 avro = super 545 return avro if avro.is_a?(String) 546 547 avro['size'] = size 548 avro['precision'] = precision if precision 549 avro['scale'] = scale if scale 550 avro 551 end