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